[hackers] [sbase] Also add proper error-reporting to chown(1) || FRIGN

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

commit 8cac5a9ef526d0d280aa42aa1a0261edabe45351
Author: FRIGN <dev_AT_frign.de>
Date: Thu Feb 12 21:57:57 2015 +0100

    Also add proper error-reporting to chown(1)

diff --git a/chown.c b/chown.c
index f965b95..575af43 100644
--- a/chown.c
+++ b/chown.c
_AT_@ -12,13 +12,14 @@ static int rflag = 0;
 static uid_t uid = -1;
 static gid_t gid = -1;
 static int ret = 0;
-static int (*chown_func)(const char *, uid_t, gid_t) = chown;
+static char *chown_f_name = "chown";
+static int (*chown_f)(const char *, uid_t, gid_t) = chown;
 
 static void
 chownpwgr(const char *path)
 {
- if (chown_func(path, uid, gid) < 0) {
- weprintf("chown %s:", path);
+ if (chown_f(path, uid, gid) < 0) {
+ weprintf("%s %s:", chown_f_name, path);
                 ret = 1;
         }
         if (rflag)
_AT_@ -40,7 +41,8 @@ main(int argc, char *argv[])
 
         ARGBEGIN {
         case 'h':
- chown_func = lchown;
+ chown_f_name = "lchown";
+ chown_f = lchown;
                 break;
         case 'R':
         case 'r':
Received on Tue Mar 24 2015 - 23:53:46 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:09:59 CET