GNU bug report logs -
#16338
[PATCH 2/2] Fix filesystem detection on non 512 byte sectors
Previous Next
Reported by: Phillip Susi <psusi <at> ubuntu.com>
Date: Sat, 4 Jan 2014 05:28:01 UTC
Severity: normal
Tags: patch
Done: Phillip Susi <psusi <at> ubuntu.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
The changes to fix filesystem detection on non 512 byte sector sizes broke
fat filesystem resizing.
---
libparted/fs/r/fat/fat.c | 6 +++++-
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;
--
1.9.1
This bug report was last modified 11 years and 41 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.