From: Theodore Ts'o Date: Mon, 14 May 2018 22:22:09 +0000 (-0400) Subject: mke2fs: print error string if ext2fs_close_free() fails X-Git-Tag: v1.44.2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61d16c39ff93f3da4ba9e2f6ee1359d48a2da969;p=thirdparty%2Fe2fsprogs.git mke2fs: print error string if ext2fs_close_free() fails 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 --- diff --git a/misc/mke2fs.c b/misc/mke2fs.c index e18d9bc66..57b5bbf9c 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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"))