Skip to content

Commit b4bcdff

Browse files
psychildshuahkh
authored andcommitted
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] ``` Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 611fbeb commit b4bcdff

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/testing/selftests/filesystems/statmount/statmount_test_ns.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,11 @@ static void test_listmount_ns(void)
319319
* Tell our parent how many mounts we have, and then wait for it
320320
* to tell us we're done.
321321
*/
322-
write(child_ready_pipe[1], &nr_mounts, sizeof(nr_mounts));
323-
read(parent_ready_pipe[0], &cval, sizeof(cval));
322+
if (write(child_ready_pipe[1], &nr_mounts, sizeof(nr_mounts)) !=
323+
sizeof(nr_mounts))
324+
ret = NSID_ERROR;
325+
if (read(parent_ready_pipe[0], &cval, sizeof(cval)) != sizeof(cval))
326+
ret = NSID_ERROR;
324327
exit(NSID_PASS);
325328
}
326329

0 commit comments

Comments
 (0)