* under the terms of the GNU Public License.
*/
+#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
printf(_("Error reading block %lu (%s). "), block,
error_message(error));
preenhalt(ctx);
+
+ /* Don't rewrite a block past the end of the FS. */
+ if (block >= ext2fs_blocks_count(fs->super))
+ return 0;
+
if (ask(ctx, _("Ignore error"), 1)) {
if (ask(ctx, _("Force rewrite"), 1))
- io_channel_write_blk64(channel, block, 1, data);
+ io_channel_write_blk64(channel, block, count, data);
return 0;
}