summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-03-19 07:52:48 +0530
committerVijay Bellur <vbellur@redhat.com>2014-04-28 09:53:35 -0700
commite49e56c5e81e7e6a4cc4d0ac2982446dd1887ef9 (patch)
treeea51ecc94dc17486184db8d1262720eb64ff6a8f /xlators/storage/posix/src/posix.c
parent800258b54a4a776430410eb949cfded147c4ae8a (diff)
storage/posix: add list xattr capability to lookup
BUG: 1078061 Change-Id: Ib84f40c84e2d66c86b1cec4a7cceb5aea189ba4a Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7434 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index d134eceb80e..f22770eb41a 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3220,13 +3220,18 @@ posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode,
goto out;
}
- list = alloca (size + 1);
+ list = alloca (size);
if (!list) {
*op_errno = errno;
goto out;
}
size = sys_llistxattr (leaf_path, list, size);
+ if (size < 0) {
+ op_ret = -1;
+ *op_errno = errno;
+ goto out;
+ }
remaining_size = size;
list_offset = 0;
@@ -3240,8 +3245,6 @@ posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode,
}
while (remaining_size > 0) {
- if (*(list + list_offset) == '\0')
- break;
strcpy (key, list + list_offset);
if (strncmp (key, PGFID_XATTR_KEY_PREFIX,
strlen (PGFID_XATTR_KEY_PREFIX)) != 0)
@@ -3605,20 +3608,22 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (size == 0)
goto done;
- list = alloca (size + 1);
+ list = alloca (size);
if (!list) {
op_errno = errno;
goto out;
}
size = sys_llistxattr (real_path, list, size);
+ if (size < 0) {
+ op_ret = -1;
+ op_errno = errno;
+ goto out;
+ }
remaining_size = size;
list_offset = 0;
while (remaining_size > 0) {
- if (*(list + list_offset) == '\0')
- break;
-
strcpy (key, list + list_offset);
size = sys_lgetxattr (real_path, key, NULL, 0);
if (size == -1) {