1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-27 08:00:11 +00:00

/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
This commit is contained in:
Henrich Hartzer 2024-05-10 17:53:49 +00:00 committed by Warner Losh
parent 3d966ae789
commit 9bcc1b18c1
3 changed files with 12 additions and 11 deletions

View File

@ -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

View File

@ -112,5 +112,5 @@ usage(void)
{
(void)fprintf(stderr, "usage: rmdir [-pv] directory ...\n");
exit(1);
exit(2);
}

View File

@ -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()