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
committerAnand Avati <avati@redhat.com>2014-04-29 14:16:30 -0700
commit91ab65f812ec3b674f53230eacbd0d71964d3d01 (patch)
treec27d9c03a230d99d0bdac3d1310cc653e9e6b37f /xlators/storage/posix/src/posix.c
parentb00ef83d2b15594526b1c58ef944a7edaa7e9dfe (diff)
storage/posix: add list xattr capability to lookup
BUG: 1078061 Change-Id: Ie26d28b8a74aa0d1eceff14a84c3cd3e302dcdb5 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7293 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index c6a3aa3c4a4..411f027f7e1 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3232,13 +3232,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;
@@ -3252,8 +3257,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)
@@ -3629,19 +3632,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 (keybuffer, list + list_offset);
size = sys_lgetxattr (real_path, keybuffer, NULL, 0);
if (size == -1) {