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>
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"))