From: Theodore Ts'o Date: Mon, 14 Aug 2000 14:44:15 +0000 (+0000) Subject: ChangeLog, mke2fs.c: X-Git-Tag: E2FSPROGS-1_20~261 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=e41784eb0e47ff5e460b635c86a0cef7250b48b4;p=tools%2Fe2fsprogs.git ChangeLog, mke2fs.c: mke2fs.c (zap_sector): Change zap_bootsect to more general zap_sect. (main): Clear the superblock when starting mke2fs, to avoid leaving the filesystem in an inconsistent state. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index 56273d4..6654956 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,10 @@ +2000-08-14 + + * mke2fs.c (zap_sector): Change zap_bootsect to more general + zap_sect. + (main): Clear the superblock when starting mke2fs, to + avoid leaving the filesystem in an inconsistent state. + 2000-07-26 * get_device_by_label.c: Improve /proc/partitions parsing in diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 5d012c1..a38240e 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -548,20 +548,20 @@ static void reserve_inodes(ext2_filsys fs) ext2fs_mark_ib_dirty(fs); } -#ifdef ZAP_BOOTBLOCK -static void zap_bootblock(ext2_filsys fs) +static void zap_sector(ext2_filsys fs, int sect) { char buf[512]; int retval; memset(buf, 0, 512); - retval = io_channel_write_blk(fs->io, 0, -512, buf); + io_channel_set_blksize(fs->io, 512); + retval = io_channel_write_blk(fs->io, sect, -512, buf); + io_channel_set_blksize(fs->io, fs->blocksize); if (retval) printf(_("Warning: could not erase block 0: %s\n"), error_message(retval)); } -#endif static void show_stats(ext2_filsys fs) @@ -1035,6 +1035,11 @@ int main (int argc, char *argv[]) } /* + * Wipe out the old on-disk superblock + */ + zap_sector(fs, 2); + + /* * Generate a UUID for it... */ s = (struct ext2fs_sb *) fs->super; @@ -1103,7 +1108,7 @@ int main (int argc, char *argv[]) reserve_inodes(fs); create_bad_block_inode(fs, bb_list); #ifdef ZAP_BOOTBLOCK - zap_bootblock(fs); + zap_sector(fs, 0); #endif }