* Re-mount the test file-system. This function randomly select how to
* re-mount.
*/
-void remount_tested_fs(void)
+static int remount_tested_fs(void)
{
char *wd_save;
int ret;
flags = fsinfo.mount_flags | MS_RDONLY | MS_REMOUNT;
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
flags = fsinfo.mount_flags | MS_REMOUNT;
flags &= ~((unsigned long)MS_RDONLY);
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
if (um) {
flags = fsinfo.mount_flags | MS_RDONLY | MS_REMOUNT;
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
CHECK(umount(fsinfo.mount_point) != -1);
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, fsinfo.mount_flags,
fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
} else {
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, fsinfo.mount_flags | MS_RDONLY,
fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
flags = fsinfo.mount_flags | MS_REMOUNT;
flags &= ~((unsigned long)MS_RDONLY);
ret = mount(fsinfo.fsdev, fsinfo.mount_point,
fsinfo.fstype, flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
}
flags = fsinfo.mount_flags | MS_RDONLY | MS_REMOUNT;
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
flags = fsinfo.mount_flags | MS_REMOUNT;
flags &= ~((unsigned long)MS_RDONLY);
ret = mount(fsinfo.fsdev, fsinfo.mount_point, fsinfo.fstype,
flags, fsinfo.mount_opts);
- CHECK(ret == 0);
+ if (ret)
+ return -1;
}
/* Restore the previous working directory */
CHECK(chdir(wd_save) == 0);
free(wd_save);
+ return 0;
}
/*
if (fsinfo.is_rootfs) {
close_open_files();
- remount_tested_fs();
+ ret = remount_tested_fs();
+ if (ret)
+ return -1;
}
/* Check everything */
if (!fsinfo.is_rootfs) {
close_open_files();
- remount_tested_fs();
+ ret = remount_tested_fs();
+ if (ret)
+ return -1;
}
/* Check everything */