sbase

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

commit 8cac5a9ef526d0d280aa42aa1a0261edabe45351
parent c965539b66439c9abea0ab5c617f93156b1a60da
Author: FRIGN <dev@frign.de>
Date:   Thu, 12 Feb 2015 21:57:57 +0100

Also add proper error-reporting to chown(1)

Diffstat:
Mchown.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/chown.c b/chown.c @@ -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) @@ -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':