Also add proper error-reporting to chown(1)
This commit is contained in:
parent
c965539b66
commit
8cac5a9ef5
10
chown.c
10
chown.c
|
@ -12,13 +12,14 @@ static int rflag = 0;
|
||||||
static uid_t uid = -1;
|
static uid_t uid = -1;
|
||||||
static gid_t gid = -1;
|
static gid_t gid = -1;
|
||||||
static int ret = 0;
|
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
|
static void
|
||||||
chownpwgr(const char *path)
|
chownpwgr(const char *path)
|
||||||
{
|
{
|
||||||
if (chown_func(path, uid, gid) < 0) {
|
if (chown_f(path, uid, gid) < 0) {
|
||||||
weprintf("chown %s:", path);
|
weprintf("%s %s:", chown_f_name, path);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
if (rflag)
|
if (rflag)
|
||||||
|
@ -40,7 +41,8 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'h':
|
case 'h':
|
||||||
chown_func = lchown;
|
chown_f_name = "lchown";
|
||||||
|
chown_f = lchown;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
case 'r':
|
case 'r':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user