Whamcloud - gitweb
libext2fs: add metadata checksum and snapshot feature flags
[tools/e2fsprogs.git] / e2fsck / ehandler.c
index 16d6d4f..10216db 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ehandler.c --- handle bad block errors which come up during the
  *     course of an e2fsck session.
- * 
+ *
  * Copyright (C) 1994 Theodore Ts'o.  This file may be redistributed
  * under the terms of the GNU Public License.
  */
@@ -33,7 +33,8 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
        e2fsck_t ctx;
 
        ctx = (e2fsck_t) fs->priv_data;
-
+       if (ctx->flags & E2F_FLAG_EXITING)
+               return 0;
        /*
         * If more than one block was read, try reading each block
         * separately.  We could use the actual bytes read to figure
@@ -42,7 +43,7 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
        if (count > 1) {
                p = (char *) data;
                for (i=0; i < count; i++, p += channel->block_size, block++) {
-                       error = io_channel_read_blk(channel, block,
+                       error = io_channel_read_blk64(channel, block,
                                                    1, p);
                        if (error)
                                return error;
@@ -58,7 +59,7 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
        preenhalt(ctx);
        if (ask(ctx, _("Ignore error"), 1)) {
                if (ask(ctx, _("Force rewrite"), 1))
-                       io_channel_write_blk(channel, block, 1, data);
+                       io_channel_write_blk64(channel, block, 1, data);
                return 0;
        }
 
@@ -77,8 +78,10 @@ static errcode_t e2fsck_handle_write_error(io_channel channel,
        const char      *p;
        ext2_filsys fs = (ext2_filsys) channel->app_data;
        e2fsck_t ctx;
-       
+
        ctx = (e2fsck_t) fs->priv_data;
+       if (ctx->flags & E2F_FLAG_EXITING)
+               return 0;
 
        /*
         * If more than one block was written, try writing each block
@@ -88,14 +91,14 @@ static errcode_t e2fsck_handle_write_error(io_channel channel,
        if (count > 1) {
                p = (const char *) data;
                for (i=0; i < count; i++, p += channel->block_size, block++) {
-                       error = io_channel_write_blk(channel, block,
+                       error = io_channel_write_blk64(channel, block,
                                                     1, p);
                        if (error)
                                return error;
                }
                return 0;
        }
-       
+
        if (operation)
                printf(_("Error writing block %lu (%s) while %s.  "), block,
                       error_message(error), operation);