selftests: filesystems: fix warn_unused_result build warnings
PATCH 1/1 selftests: filesystems: fix warn_unused_result build warnings
Add return value checks for read & write calls in test_listmount_ns function. This patch resolves below compilation warnings:
``` statmount_test_ns.c: In function ‘test_listmount_ns’: statmount_test_ns.c:322:17: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] statmount_test_ns.c:323:17: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result] ```
--- .../selftests/filesystems/statmount/statmount_test_ns.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/filesystems/statmount/statmount_test_ns.c +5 -2
@@ -319,8 +319,11 @@ static void test_listmount_ns(void)* Tell our parent how many mounts we have, and then wait for it * to tell us we're done. */ -write (child_ready_pipe[1 ], &nr_mounts,sizeof (nr_mounts)); -read (parent_ready_pipe[0 ], &cval,sizeof (cval)); +if (write (child_ready_pipe[1 ], &nr_mounts,sizeof (nr_mounts)) != +sizeof (nr_mounts)) + ret =NSID_ERROR ; +if (read (parent_ready_pipe[0 ], &cval,sizeof (cval)) !=sizeof (cval)) + ret =NSID_ERROR ;exit (NSID_PASS ); }
Signature · 1 line
2.34.1
Shuah Khan
maintainerQuoted 26 lines · Abhinav Jain
Add return value checks for read & write calls in
test_listmount_nsfunction. This patch resolves below compilation warnings:``` statmount_test_ns.c: In function ‘test_listmount_ns’: statmount_test_ns.c:322:17: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] statmount_test_ns.c:323:17: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result] ```Signed-off-by Abhinav Jain <[email protected]>--- .../selftests/filesystems/statmount/statmount_test_ns.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tools/testing/selftests/filesystems/statmount/statmount_test_ns.c +0
-0@@ -319,8 +319,11 @@ static void test_listmount_ns(void)* Tell our parent how many mounts we have, and then wait for it * to tell us we're done. */
tools/testing/selftests/filesystems/statmount/statmount_test_ns.c static void test_listmount_ns(void) · line 329
Quoted 10 lines
tools/testing/selftests/filesystems/statmount/statmount_test_ns.c +5
-2-write (child_ready_pipe[1 ], &nr_mounts,sizeof (nr_mounts)); -read (parent_ready_pipe[0 ], &cval,sizeof (cval)); +if (write (child_ready_pipe[1 ], &nr_mounts,sizeof (nr_mounts)) != +sizeof (nr_mounts)) + ret =NSID_ERROR ; +if (read (parent_ready_pipe[0 ], &cval,sizeof (cval)) !=sizeof (cval)) + ret =NSID_ERROR ;exit (NSID_PASS ); }
Hi Christian,
Let me know if it is okay to take this patch through kselftest tree. The change looks good to me.
thanks,
-- Shuah
Shuah Khan
maintainerQuoted 17 lines · Shuah Khan
Quoted 13 lines · Abhinav Jain
Add return value checks for read & write calls in
test_listmount_nsfunction. This patch resolves below compilation warnings:``` statmount_test_ns.c: In function ‘test_listmount_ns’: statmount_test_ns.c:322:17: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] statmount_test_ns.c:323:17: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result] ```Quoted 2 lines
Signed-off-by Abhinav Jain <[email protected]>---
Quoted 7 lines
Hi Christian,
Let me know if it is okay to take this patch through kselftest tree. The change looks good to me.
thanks,
-- Shuah
Thank you for the patch.
Applied to linux-kselftest next for Linux 6.12-rc1
thanks,
-- Shuah