From 7098810daf7d1ba9287a51dc596d78d70d270337 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 14 Jul 2002 08:00:00 -0400 Subject: [PATCH] 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.) --- misc/ChangeLog | 6 ++++++ misc/mke2fs.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/misc/ChangeLog b/misc/ChangeLog index a59e436..6de1398 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 5625496..22d1ae7 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); -- 1.8.3.1