Whamcloud - gitweb
mke2fs.c (zap_sector): Allocate sufficient space for zero-filled
authorTheodore Ts'o <tytso@mit.edu>
Mon, 17 Sep 2001 14:38:06 +0000 (10:38 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 17 Sep 2001 14:38:06 +0000 (10:38 -0400)
buffer.

misc/ChangeLog
misc/mke2fs.c

index d1986b0..c515f4f 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-13  Theodore Tso  <tytso@valinux.com>
+
+       * mke2fs.c (zap_sector): Allocate sufficient space for 
+               zero-filled buffer.
+
 2001-09-02  Theodore Tso  <tytso@thunk.org>
 
        * Release of E2fsprogs 1.24a
index bb5c249..1d9f7ff 100644 (file)
@@ -550,14 +550,16 @@ static void reserve_inodes(ext2_filsys fs)
 
 static void zap_sector(ext2_filsys fs, int sect, int nsect)
 {
-       char buf[512];
+       char *buf;
        int retval;
 
-       memset(buf, 0, 512);
+       buf = malloc(512*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);
+       free(buf);
        if (retval)
                printf(_("Warning: could not erase sector %d: %s\n"), sect,
                       error_message(retval));