]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: filesystems: fix warn_unused_result build warnings
authorAbhinav Jain <jain.abhinav177@gmail.com>
Sat, 10 Aug 2024 13:53:33 +0000 (19:23 +0530)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 3 Sep 2024 17:42:55 +0000 (11:42 -0600)
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>
tools/testing/selftests/filesystems/statmount/statmount_test_ns.c

index e044f5fc57fda8422698bddda88cb1760991efbc..70cb0c8b21cf03e770608cbeced53052040e550a 100644 (file)
@@ -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);
        }