diff options
| author | Henrich Hartzer <henrichhartzer@tuta.io> | 2024-05-10 17:53:49 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2024-05-11 19:13:28 +0000 |
| commit | 9bcc1b18c119148e4455e548c90b2bc9cef16d1b (patch) | |
| tree | 0faaf35d3f5fdd5269840aa43276388ed86083ba | |
| parent | 3d966ae7895b40c7a4985f61ff4819c25c8618c9 (diff) | |
| download | src-9bcc1b18c119148e4455e548c90b2bc9cef16d1b.tar.gz src-9bcc1b18c119148e4455e548c90b2bc9cef16d1b.zip | |
/bin/rmdir: Exit with status 2 for invalid arguments
PR: 277677
Signed-off-by: Henrich Hartzer <henrichhartzer@tuta.io>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1161
| -rw-r--r-- | bin/rmdir/rmdir.1 | 15 | ||||
| -rw-r--r-- | bin/rmdir/rmdir.c | 2 | ||||
| -rw-r--r-- | bin/rmdir/tests/rmdir_test.sh | 6 |
3 files changed, 12 insertions, 11 deletions
diff --git a/bin/rmdir/rmdir.1 b/bin/rmdir/rmdir.1 index 87ca1f1547f0..eb23c605050c 100644 --- a/bin/rmdir/rmdir.1 +++ b/bin/rmdir/rmdir.1 @@ -74,14 +74,14 @@ The .Nm utility exits with one of the following values: .Bl -tag -width indent -.It Li 0 -Each directory entry specified by a +.It Er 0 +Each .Ar directory -operand -referred to an empty directory and was removed -successfully. -.It Li >0 -An error occurred. +referred to an empty directory and was removed successfully. +.It Er 1 +An error occurred while attempting to remove one or more directories. +.It Er 2 +Invalid arguments. .El .Sh EXAMPLES Remove the directory @@ -97,6 +97,7 @@ stopping at the first non-empty directory (if any): .Dl $ rmdir -p cow/horse/monkey .Sh SEE ALSO .Xr rm 1 +.Xr rmdir 2 .Sh STANDARDS The .Nm diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c index c5d3db831309..0a495018495c 100644 --- a/bin/rmdir/rmdir.c +++ b/bin/rmdir/rmdir.c @@ -112,5 +112,5 @@ usage(void) { (void)fprintf(stderr, "usage: rmdir [-pv] directory ...\n"); - exit(1); + exit(2); } diff --git a/bin/rmdir/tests/rmdir_test.sh b/bin/rmdir/tests/rmdir_test.sh index d443849258b6..ba80ac6204be 100644 --- a/bin/rmdir/tests/rmdir_test.sh +++ b/bin/rmdir/tests/rmdir_test.sh @@ -35,8 +35,8 @@ invalid_usage_head() invalid_usage_body() { - atf_check -s not-exit:0 -e match:"$usage_output" rmdir -p - atf_check -s not-exit:0 -e match:"$usage_output" rmdir -v + atf_check -s exit:2 -e match:"$usage_output" rmdir -p + atf_check -s exit:2 -e match:"$usage_output" rmdir -v } atf_test_case no_arguments @@ -47,7 +47,7 @@ no_arguments_head() no_arguments_body() { - atf_check -s not-exit:0 -e match:"$usage_output" rmdir + atf_check -s exit:2 -e match:"$usage_output" rmdir } atf_init_test_cases() |
