diff options
author | Phillip Susi <psusi@ubuntu.com> | 2014-04-18 17:00:02 -0400 |
---|---|---|
committer | Phillip Susi <psusi@ubuntu.com> | 2014-05-22 19:56:36 -0400 |
commit | 5adae27101565a5d6fed4aadf28ddb39872e41f5 (patch) | |
tree | 97796a3f8ba8fe0e3b88f5dd30025c2fd39a5583 | |
parent | d80457356f41f1abdf84733923113087068e9bca (diff) | |
download | parted-5adae27101565a5d6fed4aadf28ddb39872e41f5.tar.gz |
libparted: fix fat resize
The changes to fix filesystem detection on non 512 byte sector sizes broke
fat filesystem resizing.
-rw-r--r-- | libparted/fs/r/fat/fat.c | 6 | ||||
-rw-r--r-- | libparted/fs/r/fat/resize.c | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c index fdc1ecc..8d7420b 100644 --- a/libparted/fs/r/fat/fat.c +++ b/libparted/fs/r/fat/fat.c @@ -35,7 +35,9 @@ fat_alloc (const PedGeometry* geom) fs->type_specific = (FatSpecific*) ped_malloc (sizeof (FatSpecific)); if (!fs->type_specific) goto error_free_fs; - + FatSpecific* fs_info = (FatSpecific*) fs->type_specific; + fs_info->boot_sector = NULL; + fs_info->info_sector = NULL; fs->geom = ped_geometry_duplicate (geom); if (!fs->geom) goto error_free_type_specific; @@ -86,6 +88,8 @@ fat_free_buffers (PedFileSystem* fs) void fat_free (PedFileSystem* fs) { + FatSpecific* fs_info = (FatSpecific*) fs->type_specific; + free (fs_info->boot_sector); ped_geometry_destroy (fs->geom); free (fs->type_specific); free (fs); diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c index f3439ac..046382b 100644 --- a/libparted/fs/r/fat/resize.c +++ b/libparted/fs/r/fat/resize.c @@ -667,10 +667,12 @@ create_resize_context (PedFileSystem* fs, const PedGeometry* new_geom) goto error_free_new_fs; /* preserve boot code, etc. */ - memcpy (&new_fs_info->boot_sector, &fs_info->boot_sector, - sizeof (FatBootSector)); - memcpy (&new_fs_info->info_sector, &fs_info->info_sector, - sizeof (FatInfoSector)); + new_fs_info->boot_sector = ped_malloc (new_geom->dev->sector_size); + new_fs_info->info_sector = ped_malloc (new_geom->dev->sector_size); + memcpy (new_fs_info->boot_sector, fs_info->boot_sector, + new_geom->dev->sector_size); + memcpy (new_fs_info->info_sector, fs_info->info_sector, + new_geom->dev->sector_size); new_fs_info->logical_sector_size = fs_info->logical_sector_size; new_fs_info->sector_count = new_geom->length; |