diff options
| author | ngkaho1234 <ngkaho1234@gmail.com> | 2015-10-10 00:07:55 +0800 |
|---|---|---|
| committer | ngkaho1234 <ngkaho1234@gmail.com> | 2015-10-10 00:07:55 +0800 |
| commit | 9792c01efcf868269bab6cce4fa6efefcc1adcb6 (patch) | |
| tree | 895fe23ddb5c594e807dd632b12498dfb1f49c6e | |
| parent | a1a24db03c42c2f6af2aa97dc9a145dbb03559e2 (diff) | |
FIX: ext4_listxattr not returning required list buffer size when size == 0.
| -rw-r--r-- | lwext4/ext4.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lwext4/ext4.c b/lwext4/ext4.c index 216fc9d..6923b1b 100644 --- a/lwext4/ext4.c +++ b/lwext4/ext4.c @@ -2102,11 +2102,16 @@ int ext4_listxattr(const char *path, char *list, size_t size, size_t *ret_size) xattr_ref.iter_arg = &lxi; ext4_fs_xattr_iterate(&xattr_ref, ext4_iterate_ea_list); - if (ret_size && lxi.list_too_small) { - *ret_size = lxi.ret_size; + if (lxi.list_too_small) r = ERANGE; - } + if (r == EOK) { + if (lxi.get_required_size) { + if (ret_size) + *ret_size = lxi.ret_size; + + } + } ext4_fs_put_xattr_ref(&xattr_ref); ext4_fs_put_inode_ref(&inode_ref); Finish: |
