From 9cd8edce5f890d2b3565f373eef5fdd81526a056 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 9 Jul 2005 21:24:02 +0000 Subject: [PATCH] mkntfs: Fix backup bootsector creation. Thanks to Timur Amirkhanov for pointing this stupidity out. (We forgot to set the size before doing it.) (Anton) --- ChangeLog | 13 ++++++++----- ntfsprogs/mkntfs.c | 11 +++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d74a275b..dd4e75fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,16 +1,19 @@ -xx/xx/xxxx - 1.10.1-WIP +xx/07/2005 - 1.10.1-WIP - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print correct message. (Yura) - Update manual pages for ntfsprogs, ntfsclone, ntfsresize. (Szaka) - - ntfsclone: detect and hint users if the destination fs doesn't support - sparse files. (Szaka) + - ntfsclone: detect and hint users if the destination fs does not + support sparse files. (Szaka) - Fix memory managament error in ntfs_inode_close. (Yura) - - Add new utility - ntfsmount. It's a FUSE module that - rely on libntfs. (Yura) + - Add new utility - ntfsmount. It is a FUSE module that reles on + libntfs. (Yura) - ntfsresize: support bad clusters list ($BadClus:$Bad), a.k.a. disks having bad sectors if the new --bad-sectors option is used. (Szaka) - ntfsinfo: Dump $EA_INFORMATION and $EA attributes. (Yura) + - mkntfs: Fix backup bootsector creation. Thanks to Timur Amirkhanov + for pointing this stupidity out. (We forgot to set the size before + doing it.) (Anton) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 85ae0a6e..47ff8156 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3255,17 +3255,20 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) * * Return 0 on success or 1 if it couldn't be created. */ -static int create_backup_boot_sector(u8 *buff, int size) +static int create_backup_boot_sector(u8 *buff) { - ssize_t bw; - int _e = errno; const char *_s; + ssize_t bw; + int size, _e = errno; Vprintf("Creating backup boot sector.\n"); /* * Write the first max(512, opts.sector_size) bytes from buf to the * last sector. */ + size = 512; + if (size < opts.sector_size) + size = opts.sector_size; if (vol->dev->d_ops->seek(vol->dev, (opts.nr_sectors + 1) * opts.sector_size - size, SEEK_SET) == (off_t)-1) goto bb_err; @@ -3598,7 +3601,7 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $Boot: %s\n", strerror(-err)); - if (create_backup_boot_sector(buf2, i) != 0) { + if (create_backup_boot_sector(buf2) != 0) { /* * Pre-2.6 kernels couldn't access the last sector * if it was odd hence we schedule chkdsk to create it.