test/xattr: don't rely on NUL-termination
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 test/xattr: don't rely on NUL-termination
The returned value from io_uring_fgetxattr() needs not be NUL-terminated, as we stored non-NUL-terminated string by io_uring_fsetxattr() previously.
So don't use strlen() on value, but on VALUE1, and VALUE2 respectively.
This fixes random test failures.
---
[v2] added Fixes, Cc, and fixed a typo in the message above.
test/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
test/xattr.c +2 -2
@@ -210,14 +210,14 @@ static int test_fxattr(void)/* Test reading attributes. */ value_len =io_uring_fgetxattr (&ring, fd,KEY1 , value,XATTR_SIZE ); -if (value_len !=strlen (value) ||strncmp (value,VALUE1 , value_len)) { +if (value_len !=strlen (VALUE1 ) ||strncmp (value,VALUE1 , value_len)) {fprintf (stderr,"Error: fgetxattr expected value: %s, returned value: %s\n" ,VALUE1 , value); rc =-1 ; goto Exit; } value_len =io_uring_fgetxattr (&ring, fd,KEY2 , value,XATTR_SIZE ); -if (value_len !=strlen (value)||strncmp (value,VALUE2 , value_len)) { +if (value_len !=strlen (VALUE2 ) ||strncmp (value,VALUE2 , value_len)) {fprintf (stderr,"Error: fgetxattr expected value: %s, returned value: %s\n" ,VALUE2 , value); rc =-1 ; goto Exit;
Signature · 1 line
2.35.3
Quoted 9 lines · Jiri Slaby
The returned value from
io_uring_fgetxattr()needs not be NUL-terminated, as we stored non-NUL-terminated string byio_uring_fsetxattr()previously.So don't use
strlen()on value, but on VALUE1, and VALUE2 respectively.This fixes random test failures.
[...]
Applied, thanks!
[1/1] test/xattr: don't rely on NUL-termination
commit: bf3fedba890e66d644692910964fe1d8cbf4fb1b
Best regards,
Signature · 1 line
Jens Axboe