summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/filesystems/statmount/statmount_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/filesystems/statmount/statmount_test.c')
-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);
}