diff options
Diffstat (limited to 'guts/lchown.c')
-rw-r--r-- | guts/lchown.c | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/guts/lchown.c b/guts/lchown.c index 2d0aff2..be06a8d 100644 --- a/guts/lchown.c +++ b/guts/lchown.c @@ -2,49 +2,8 @@ * static int * wrap_lchown(const char *path, uid_t owner, gid_t group) { */ - pseudo_msg_t *msg; - struct stat64 buf; - if (!path) { - errno = EFAULT; - return -1; - } - pseudo_debug(2, "lchown(%s, %d, %d)\n", - path ? path : "<nil>", owner, group); - if (real___lxstat64(_STAT_VER, path, &buf) == -1) { - return -1; - } - if (owner == -1 || group == -1) { - msg = pseudo_client_op(OP_STAT, -1, -1, path, &buf); - /* copy in any existing values... */ - if (msg) { - if (msg->result == RESULT_SUCCEED) { - pseudo_stat_msg(&buf, msg); - } else { - pseudo_debug(2, "lchown to %d:%d on %s, ino %llu, new file.\n", - owner, group, path, - (unsigned long long) buf.st_ino); - } - } else { - pseudo_diag("stat within lchown of '%s' [%llu] failed.\n", - path, (unsigned long long) buf.st_ino); - } - } - if (owner != -1) { - buf.st_uid = owner; - } - if (group != -1) { - buf.st_gid = group; - } - msg = pseudo_client_op(OP_CHOWN, -1, -1, path, &buf); - if (!msg) { - errno = ENOSYS; - rc = -1; - } else if (msg->result != RESULT_SUCCEED) { - errno = msg->xerrno; - rc = -1; - } else { - rc = 0; - } + + rc = wrap_fchownat(AT_FDCWD, path, owner, group, AT_SYMLINK_NOFOLLOW); /* return rc; * } |