sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit a9c7d16cde03812aebecc990d50b3864f2ac787a
parent ae0df49f243b4103477863dc7e54afab2a521491
Author: FRIGN <dev@frign.de>
Date:   Fri, 30 Jan 2015 12:43:55 +0100

Properly report return value in rmdir(1)

Diffstat:
Mrmdir.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/rmdir.c b/rmdir.c @@ -16,7 +16,7 @@ usage(void) int main(int argc, char *argv[]) { - int pflag = 0; + int pflag = 0, ret = 0; char *d; ARGBEGIN { @@ -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) @@ -45,5 +44,5 @@ main(int argc, char *argv[]) } } } - return 0; + return ret; }