diff --git a/ChangeLog b/ChangeLog index c08c0adc..9678bbaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -84,6 +84,12 @@ xx/xx/2006 - x.xx.x - . - Set the volume dirty bit at mount time (if it is not set already and clear it again at umount time but only if it was not set to start with. (Anton) + - Introduce NTFS_MNT_FORENSIC mount option for logfile dumping for + example otherwise the logfile gets wiped out by the mount attempt if + it is not read-only. (Anton) + - Fix ntfsresize to unmount the volume when finished/exiting so it does + not leave the volume in an inconsistent state. Somewhat crude + solution using atexit() but it works... (Anton) 21/06/2006 - 1.13.1 - Various fixes. diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 719febfe..19b4b450 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2359,6 +2359,13 @@ static void check_cluster_allocation(ntfs_volume *vol, ntfsck_t *fsck) compare_bitmaps(vol, &fsck->lcn_bitmap); } +static ntfs_volume *g_vol; + +static void ntfsresize_atexit(void) { + if (g_vol && ntfs_umount(g_vol, 0) < 0) + perror("Failed to unmount volume"); +} + int main(int argc, char **argv) { ntfsck_t fsck; @@ -2377,8 +2384,12 @@ int main(int argc, char **argv) utils_set_locale(); - if ((vol = mount_volume()) == NULL) + g_vol = NULL; + if (atexit(ntfsresize_atexit)) + err_exit("Failed to register exit handler!"); + if (!(vol = mount_volume())) err_exit("Couldn't open volume '%s'!\n", opt.volume); + g_vol = vol; device_size = ntfs_device_size_get(vol->dev, vol->sector_size); device_size *= vol->sector_size;