[hackers] [sbase] Fix exit status with -f for nonexistent paths || FRIGN

From: <git_AT_suckless.org>
Date: Tue, 3 Mar 2015 14:32:25 +0100 (CET)

commit d8f83002951532e97029b356cc5cbc906a72683c
Author: FRIGN <dev_AT_frign.de>
Date: Sun Mar 1 23:48:50 2015 +0100

    Fix exit status with -f for nonexistent paths
    
    Thanks Michael Forney <mforney_AT_mforney.org> for reporting this!

diff --git a/libutil/rm.c b/libutil/rm.c
index 53ae3f2..aa6648b 100644
--- a/libutil/rm.c
+++ b/libutil/rm.c
_AT_@ -1,4 +1,5 @@
 /* See LICENSE file for copyright and license details. */
+#include <errno.h>
 #include <stdio.h>
 
 #include "../fs.h"
_AT_@ -16,6 +17,6 @@ rm(const char *path, int unused)
         if (remove(path) < 0) {
                 if (!rm_fflag)
                         weprintf("remove %s:", path);
- rm_status = 1;
+ rm_status = !(rm_fflag && errno == ENOENT);
         }
 }
Received on Tue Mar 03 2015 - 14:32:25 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 03 2015 - 14:36:13 CET