summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-10-01 06:59:07 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-01 07:24:01 -0700
commitbdeb23cac1edbc7d88978b3676461db462d89c53 (patch)
tree20aaee07908b3026cb92835add3e7e0fad60517d
parentb017bcb852e3549ba7dc1dc6d23e157178bb1305 (diff)
libglusterfsclient: Use setattr for chown
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-xlibglusterfsclient/src/libglusterfsclient.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index b4e62e55ced..1f625019b25 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -5320,11 +5320,16 @@ __glusterfs_chown (glusterfs_handle_t handle, const char *path, uid_t owner,
char *name = NULL;
loc_t *oploc = NULL;
loc_t targetloc = {0, };
+ struct stat stbuf = {0,};
+ int32_t valid = 0;
GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, ctx, out);
GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO (LIBGF_XL_NAME, path, out);
gf_log (LIBGF_XL_NAME, GF_LOG_DEBUG, "path %s, op %d", path, whichop);
+ stbuf.st_uid = owner;
+ stbuf.st_gid = group;
+ valid |= (GF_SET_ATTR_UID | GF_SET_ATTR_GID);
loc.path = libgf_resolve_path_light ((char *)path);
if (!loc.path) {
gf_log (LIBGF_XL_NAME, GF_LOG_ERROR, "Path compaction failed");
@@ -5356,7 +5361,7 @@ __glusterfs_chown (glusterfs_handle_t handle, const char *path, uid_t owner,
oploc = &targetloc;
do_lchown:
- op_ret = libgf_client_chown (ctx, oploc, owner, group);
+ op_ret = libgf_client_setattr (ctx, oploc, &stbuf, valid);
out:
if (name)
FREE (name);