]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - e2fsck/badblocks.c
e2fsck: if user declines to fix s_inodes_acount, abort
[thirdparty/e2fsprogs.git] / e2fsck / badblocks.c
index fa183b85100ef44676195ce668bc0018bec99cee..7f3641b5e6c4e9c5e5d29f50116bf7162a38ad61 100644 (file)
@@ -5,6 +5,7 @@
  * redistributed under the terms of the GNU Public License.
  */
 
+#include "config.h"
 #include <time.h>
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
@@ -41,7 +42,7 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
        retval = ext2fs_block_iterate(fs, EXT2_BAD_INO, 0, 0,
                                      check_bb_inode_blocks, 0);
        if (retval) {
-               com_err("ext2fs_block_iterate", retval,
+               com_err("ext2fs_block_iterate", retval, "%s",
                        _("while sanity checking the bad blocks inode"));
                goto fatal;
        }
@@ -53,7 +54,7 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
        if (!replace_bad_blocks) {
                retval = ext2fs_read_bb_inode(fs, &bb_list);
                if (retval) {
-                       com_err("ext2fs_read_bb_inode", retval,
+                       com_err("ext2fs_read_bb_inode", retval, "%s",
                                _("while reading the bad blocks inode"));
                        goto fatal;
                }
@@ -89,7 +90,7 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
        else
                pclose(f);
        if (retval) {
-               com_err("ext2fs_read_bb_FILE", retval,
+               com_err("ext2fs_read_bb_FILE", retval, "%s",
                        _("while reading in list of bad blocks from file"));
                goto fatal;
        }
@@ -100,7 +101,7 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
        printf("%s: Updating bad block inode.\n", ctx->device_name);
        retval = ext2fs_update_bb_inode(fs, bb_list);
        if (retval) {
-               com_err("ext2fs_update_bb_inode", retval,
+               com_err("ext2fs_update_bb_inode", retval, "%s",
                        _("while updating bad block inode"));
                goto fatal;
        }
@@ -110,6 +111,8 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
 
 fatal:
        ctx->flags |= E2F_FLAG_ABORT;
+       if (bb_list)
+               ext2fs_badblocks_list_free(bb_list);
        return;
 
 }