[hackers] [sbase] Properly report return value in rmdir(1) || FRIGN

From: <git_AT_suckless.org>
Date: Tue, 24 Mar 2015 23:53:22 +0100 (CET)

commit a9c7d16cde03812aebecc990d50b3864f2ac787a
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 Tue Mar 24 2015 - 23:53:22 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:04:20 CET