summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAmer Al Shanawany <amer.shanawany@gmail.com>2024-04-17 20:49:13 +0200
committerShuah Khan <skhan@linuxfoundation.org>2024-06-11 09:21:30 -0600
commit2049aad5d3a6921f80121029afe6fbcfb2727861 (patch)
tree2cd1aaef0af846545d8530ec192f5beb398e2479 /tools
parent4bf15b1c657d22d1d70173e43264e4606dfe75ff (diff)
downloadlinux-stable-2049aad5d3a6921f80121029afe6fbcfb2727861.tar.gz
linux-stable-2049aad5d3a6921f80121029afe6fbcfb2727861.tar.bz2
linux-stable-2049aad5d3a6921f80121029afe6fbcfb2727861.zip
selftests: filesystems: fix warn_unused_result build warnings
Fix the following warnings by adding return check and error messages. statmount_test.c: In function ‘cleanup_namespace’: statmount_test.c:128:9: warning: ignoring return value of ‘fchdir’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 128 | fchdir(orig_root); | ^~~~~~~~~~~~~~~~~ statmount_test.c:129:9: warning: ignoring return value of ‘chroot’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 129 | chroot("."); | ^~~~~~~~~~~ Signed-off-by: Amer Al Shanawany <amer.shanawany@gmail.com> Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/filesystems/statmount/statmount_test.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
index e6d7c4f1c85b..e8c019d72cbf 100644
--- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
+++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
@@ -125,8 +125,16 @@ static uint32_t old_root_id, old_parent_id;
static void cleanup_namespace(void)
{
- fchdir(orig_root);
- chroot(".");
+ int ret;
+
+ ret = fchdir(orig_root);
+ if (ret == -1)
+ ksft_perror("fchdir to original root");
+
+ ret = chroot(".");
+ if (ret == -1)
+ ksft_perror("chroot to original root");
+
umount2(root_mntpoint, MNT_DETACH);
rmdir(root_mntpoint);
}