From: Theodore Ts'o Date: Sun, 14 Jul 2002 12:00:00 +0000 (-0400) Subject: mke2fs.c (zap_sector): Clear the buffer *after* testing for the X-Git-Tag: E2FSPROGS-1.28-WIP-0817~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7098810daf7d1ba9287a51dc596d78d70d270337;p=thirdparty%2Fe2fsprogs.git mke2fs.c (zap_sector): Clear the buffer *after* testing for the BSD sector label. Otherwise the first 512 bytes don't get zapped. (Addresses Debian bug #147256.) --- diff --git a/misc/ChangeLog b/misc/ChangeLog index a59e436e8..6de1398ab 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,9 @@ +2002-07-14 Theodore Ts'o + + * mke2fs.c (zap_sector): Clear the buffer *after* testing for the + BSD sector label. Otherwise the first 512 bytes don't get + zapped. (Addresses Debian bug #147256.) + 2002-07-02 Theodore Ts'o * mke2fs.8.in: Cleaned up man page, and made it a bit more diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 562549615..22d1ae789 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -571,7 +571,6 @@ static void zap_sector(ext2_filsys fs, int sect, int nsect) sect, sect + nsect - 1); exit(1); } - memset(buf, 0, 512*nsect); if (sect == 0) { /* Check for a BSD disklabel, and don't erase it if so */ @@ -588,6 +587,7 @@ static void zap_sector(ext2_filsys fs, int sect, int nsect) } } + memset(buf, 0, 512*nsect); io_channel_set_blksize(fs->io, 512); retval = io_channel_write_blk(fs->io, sect, -512*nsect, buf); io_channel_set_blksize(fs->io, fs->blocksize);