Whamcloud - gitweb
mke2fs: print error string if ext2fs_close_free() fails
authorTheodore Ts'o <tytso@mit.edu>
Mon, 14 May 2018 22:22:09 +0000 (18:22 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 14 May 2018 22:22:09 +0000 (18:22 -0400)
There are multiple reasons why ext2fs_close_free() might fail, not
just an I/O error while writing out a backup superblock.  Print the
error code, and then allow mke2fs to exit with an exit status code of
1, instead of whatever random error code ext2fs_close_free() might
have returned with.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c

index e18d9bc..57b5bbf 100644 (file)
@@ -3295,8 +3295,9 @@ no_journal:
        max_mnt_count = fs->super->s_max_mnt_count;
        retval = ext2fs_close_free(&fs);
        if (retval) {
-               fprintf(stderr, "%s",
-                       _("\nWarning, had trouble writing out superblocks.\n"));
+               com_err(program_name, retval, "%s",
+                       _("while writing out and closing file system"));
+               retval = 1;
        } else if (!quiet) {
                printf("%s", _("done\n\n"));
                if (!getenv("MKE2FS_SKIP_CHECK_MSG"))