]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: integck: refuse R/O file-system
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 20 Apr 2011 13:01:05 +0000 (16:01 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 22 Apr 2011 11:29:53 +0000 (14:29 +0300)
Refuse to test the file-system if it is mounted Read-only.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/fs-tests/integrity/integck.c

index e6f5b3b2ce75954aa4ddd806121963de8f585c7d..136be097e55f71f51ecbddc504d5f78c4ec78e35 100644 (file)
@@ -2681,10 +2681,15 @@ int main(int argc, char *argv[])
        random_name_buf = malloc(fsinfo.max_name_len + 1);
        CHECK(random_name_buf != NULL);
 
+       /* Refuse the file-system if it is mounted R/O */
+       if (fsinfo.mount_flags & MS_RDONLY) {
+               ret = -1;
+               errmsg("the file-system is mounted read-only");
+               goto out_free;
+       }
+
        /* Do the actual test */
        ret = integck();
-       if (ret)
-               return EXIT_FAILURE;
 
        close_open_files();
        free_fs_info(top_dir);
@@ -2692,10 +2697,11 @@ int main(int argc, char *argv[])
        free(top_dir->entry);
        free(top_dir);
 
+out_free:
        free(random_name_buf);
        free(fsinfo.mount_point);
        free(fsinfo.fstype);
        free(fsinfo.fsdev);
        free(fsinfo.test_dir);
-       return EXIT_SUCCESS;
+       return ret ? EXIT_FAILURE : EXIT_SUCCESS;
 }