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

From: <git_AT_suckless.org>
Date: Fri, 13 Feb 2015 12:22:59 +0100 (CET)

commit 9224c88c6426e677d6e63747ad8ec654b2370d1f
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 Fri Feb 13 2015 - 12:22:59 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 13 2015 - 12:24:10 CET