git: 9bcc1b18c119 - main - /bin/rmdir: Exit with status 2 for invalid arguments
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 May 2024 19:16:19 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9bcc1b18c119148e4455e548c90b2bc9cef16d1b commit 9bcc1b18c119148e4455e548c90b2bc9cef16d1b Author: Henrich Hartzer <henrichhartzer@tuta.io> AuthorDate: 2024-05-10 17:53:49 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-05-11 19:13:28 +0000 /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 --- bin/rmdir/rmdir.1 | 15 ++++++++------- bin/rmdir/rmdir.c | 2 +- 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()