[hackers] [sbase] Properly report return value in rmdir(1) || FRIGN
commit ef434ca362f3e46e5193b117bf821100f38db9e7
Author: FRIGN <dev_AT_frign.de>
Date: Fri Jan 30 12:43:55 2015 +0100
Properly report return value in rmdir(1)
diff --git a/rmdir.c b/rmdir.c
index 743db34..e6c3cdd 100644
--- a/rmdir.c
+++ b/rmdir.c
_AT_@ -16,7 +16,7 @@ usage(void)
int
main(int argc, char *argv[])
{
- int pflag = 0;
+ int pflag = 0, ret = 0;
char *d;
ARGBEGIN {
_AT_@ -33,10 +33,9 @@ main(int argc, char *argv[])
for (; argc > 0; argc--, argv++) {
if (rmdir(argv[0]) < 0) {
weprintf("rmdir %s:", argv[0]);
- if (pflag)
- return 1;
+ ret = 1;
}
- if (pflag) {
+ if (pflag && !ret) {
d = dirname(argv[0]);
for (; strcmp(d, "/") && strcmp(d, ".") ;) {
if (rmdir(d) < 0)
_AT_@ -45,5 +44,5 @@ main(int argc, char *argv[])
}
}
}
- return 0;
+ return ret;
}
Received on Fri Jan 30 2015 - 12:50:58 CET
This archive was generated by hypermail 2.3.0
: Fri Jan 30 2015 - 13:00:12 CET