[Ocfs2-test-devel] [PATCH 32/59] xattr-test: fix single test failed

Junxiao Bi junxiao.bi at oracle.com
Sun Sep 13 19:44:18 PDT 2015


The xattr size is packaged into xattr value to do validation. It must
take up 5 bytes. This bug is involved by commit
17025e03e3d81c05cc0e9816c15635773a75c5d

Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
---
 programs/xattr_tests/xattr-test-utils.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/programs/xattr_tests/xattr-test-utils.c b/programs/xattr_tests/xattr-test-utils.c
index 5a16ad6..c2c9d03 100644
--- a/programs/xattr_tests/xattr-test-utils.c
+++ b/programs/xattr_tests/xattr-test-utils.c
@@ -107,7 +107,7 @@ void xattr_name_generator(unsigned long xattr_no,
 	}
 
 	xattr_name[xattr_name_rsz - 6] = 0;
-	snprintf(postfix, 7, "%lu", xattr_no);
+	snprintf(postfix, 7, "%06d", xattr_no);
 	strcat(xattr_name, postfix);
 	strcpy(xattr_name_list_set[xattr_no], xattr_name);
 }
@@ -365,7 +365,7 @@ void xattr_value_constructor(int xattr_entry_no)
 	strlen(value_postfix_magic) -
 	strlen(xattr_name) - 5);
 
-	snprintf(value_sz, 6, "%zu", strlen(value_prefix_magic) +
+	snprintf(value_sz, 6, "%05d", strlen(value_prefix_magic) +
 		 strlen(xattr_name) + strlen(xattr_value) + 5 +
 		 strlen(value_postfix_magic));
 
-- 
1.7.9.5




More information about the Ocfs2-test-devel mailing list