mirror of
https://github.com/sheumann/hush.git
synced 2025-08-15 19:27:40 +00:00
Fix behavior when removal fails.
This commit is contained in:
@@ -28,14 +28,16 @@
|
|||||||
|
|
||||||
extern int rmdir_main(int argc, char **argv)
|
extern int rmdir_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int status = EXIT_SUCCESS;
|
||||||
|
|
||||||
if (argc == 1 || **(argv + 1) == '-')
|
if (argc == 1 || **(argv + 1) == '-')
|
||||||
usage(rmdir_usage);
|
usage(rmdir_usage);
|
||||||
|
|
||||||
while (--argc > 0) {
|
while (--argc > 0) {
|
||||||
if (rmdir(*(++argv)) == -1) {
|
if (rmdir(*(++argv)) == -1) {
|
||||||
errorMsg("%s\n", strerror(errno));
|
perrorMsg("%s", *argv);
|
||||||
exit(FALSE);
|
status = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(TRUE);
|
return status;
|
||||||
}
|
}
|
||||||
|
8
rmdir.c
8
rmdir.c
@@ -28,14 +28,16 @@
|
|||||||
|
|
||||||
extern int rmdir_main(int argc, char **argv)
|
extern int rmdir_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int status = EXIT_SUCCESS;
|
||||||
|
|
||||||
if (argc == 1 || **(argv + 1) == '-')
|
if (argc == 1 || **(argv + 1) == '-')
|
||||||
usage(rmdir_usage);
|
usage(rmdir_usage);
|
||||||
|
|
||||||
while (--argc > 0) {
|
while (--argc > 0) {
|
||||||
if (rmdir(*(++argv)) == -1) {
|
if (rmdir(*(++argv)) == -1) {
|
||||||
errorMsg("%s\n", strerror(errno));
|
perrorMsg("%s", *argv);
|
||||||
exit(FALSE);
|
status = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(TRUE);
|
return status;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user