shithub: lwext4

Download patch

ref: 9792c01efcf868269bab6cce4fa6efefcc1adcb6
parent: a1a24db03c42c2f6af2aa97dc9a145dbb03559e2
author: ngkaho1234 <[email protected]>
date: Fri Oct 9 20:07:55 EDT 2015

FIX: ext4_listxattr not returning required list buffer size when size == 0.

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -2102,11 +2102,16 @@
 
 	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: