From 23d896068f98538954772dcd90a112b6cac17d63 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Thu, 1 Oct 2009 06:59:15 +0000 Subject: libglusterfsclient: Use fsetattr for fchown Signed-off-by: Anand V. Avati BUG: 146 (Add setattr FOP) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146 --- libglusterfsclient/src/libglusterfsclient.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- cgit