mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-13 05:41:26 +01: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:
parent
3d966ae789
commit
9bcc1b18c1
@ -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
|
||||
|
@ -112,5 +112,5 @@ usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "usage: rmdir [-pv] directory ...\n");
|
||||
exit(1);
|
||||
exit(2);
|
||||
}
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user