aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2008-01-29 23:53:19 +0000
committerReuben Thomas <rrt@sc3d.org>2008-01-29 23:53:19 +0000
commitf905e7c9aa34e0364f6b8b58715495257b9600c2 (patch)
treecacf9eb3d5f45310f273425a6bea9d6056e1fcdd
parentb5e14cfb49e37e0ffd3ec5332d4a350955acb058 (diff)
downloadplptools-f905e7c9aa34e0364f6b8b58715495257b9600c2.tar.gz
plptools-f905e7c9aa34e0364f6b8b58715495257b9600c2.tar.bz2
plptools-f905e7c9aa34e0364f6b8b58715495257b9600c2.zip
Fix getxattr and setxattr
-rw-r--r--plpfuse/fuse.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/plpfuse/fuse.c b/plpfuse/fuse.c
index 97e90b4..883f1d8 100644
--- a/plpfuse/fuse.c
+++ b/plpfuse/fuse.c
@@ -435,7 +435,7 @@ static int plp_getxattr(const char *path, const char *name, char *value, size_t
return rfsv_isalive() ? -ENOENT : -NO_PSION;
pattr2xattr(pattr, value);
debuglog("getxattr succeeded: %s", value);
- return 0;
+ return strlen(value);
} else {
debuglog("only gave %d bytes, need %d", size, XATTR_MAXLEN);
return XATTR_MAXLEN;
@@ -462,9 +462,15 @@ static int plp_setxattr(const char *path, const char *name, const char *value, s
nxattr[XATTR_MAXLEN] = '\0';
if (rfsv_getattr(path, &pattr, &psize, &ptime))
return rfsv_isalive() ? -ENOENT : -NO_PSION;
- plp_getxattr(path, name, oxattr, XATTR_MAXLEN);
+ /* Need to undo earlier increment of path when calling plp_getxattr */
+ plp_getxattr(path - 1, name, oxattr, XATTR_MAXLEN);
psidattr = pattr;
xattr2pattr(&pattr, &psidattr, oxattr, value);
+ debuglog("attrs set %x delete %x; %s, %s", pattr, psidattr, oxattr, value);
+ if (rfsv_setattr(path, pattr, psidattr))
+ return rfsv_isalive() ? -EACCES : -NO_PSION;
+
+ debuglog("setxattr succeeded");
return 0;
} else {
if (flags & XATTR_REPLACE)