]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs.c (zap_sector): Clear the buffer *after* testing for the
authorTheodore Ts'o <tytso@mit.edu>
Sun, 14 Jul 2002 12:00:00 +0000 (08:00 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 14 Jul 2002 12:00:00 +0000 (08:00 -0400)
BSD sector label.  Otherwise the first 512 bytes don't get
zapped.  (Addresses Debian bug #147256.)

misc/ChangeLog
misc/mke2fs.c

index a59e436e89b7cc2abc7ba7979018917edec150e9..6de1398ab3ffdd47efdc23879782de3be0dd077b 100644 (file)
@@ -1,3 +1,9 @@
+2002-07-14  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * mke2fs.8.in: Cleaned up man page, and made it a bit more
index 562549615474cde67ec9ed86ff77d1faca25d2c0..22d1ae789442d518309e344ab0f28003220d5558 100644 (file)
@@ -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);