diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-10-01 06:59:15 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-01 07:24:30 -0700 |
commit | 23d896068f98538954772dcd90a112b6cac17d63 (patch) | |
tree | 40a5f364d00b58522ad19f7b9a2d26148c0f688e | |
parent | 1640178a1004cb5a43cdf2e5fb375807812f367f (diff) |
libglusterfsclient: Use fsetattr for fchown
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 146 (Add setattr FOP)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index b76e9171f7b..0aeb958eadd 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -5622,6 +5622,8 @@ glusterfs_fchown (glusterfs_file_t fd, uid_t uid, gid_t gid) { int op_ret = -1; libglusterfs_client_fd_ctx_t *fdctx = NULL; + struct stat stbuf = {0,}; + int32_t valid = 0; GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, fd, out); @@ -5631,8 +5633,12 @@ glusterfs_fchown (glusterfs_file_t fd, uid_t uid, gid_t gid) errno = EBADF; goto out; } + stbuf.st_uid = uid; + stbuf.st_gid = gid; - op_ret = libgf_client_fchown (fdctx->ctx, fd, uid, gid); + valid |= (GF_SET_ATTR_UID | GF_SET_ATTR_GID); + + op_ret = libgf_client_fsetattr (fdctx->ctx, fd, &stbuf, valid); out: return op_ret; |