[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Tue Nov 9 13:35:39 UTC 2010
NEWS | 4 ++++
libparted/labels/dos.c | 14 +++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
New commits:
commit 9f5b0608611eed40ef33be2096f5d482710602e5
Author: Jim Meyering <meyering at redhat.com>
Date: Tue Nov 9 10:25:36 2010 +0100
dos: fix a bug affecting very small devices (smaller than 1 cylinder)
This bug was introduced in commit c79d91ec, "dos: accommodate very
small devices (useful for testing)".
* libparted/labels/dos.c (_primary_constraint): The bug was to
skip setting start_geom for small devices. That led to a used-
uninitialized bug in the subsequent ped_constraint_new call.
The fix is to relax the constraint to use a starting sector of "1",
if necessary. Report and diagnosis by Jean-Christian de Rivaz in
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10178
* NEWS (Bug fixes): Mention it.
diff --git a/NEWS b/NEWS
index 5dd7dca..4979b90 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,10 @@ GNU parted NEWS -*- outline -*-
libparted now recognizes scsi disks with a high major (128-135) as scsi
disks
+ an msdos partition table on a very small device (smaller than one cylinder)
+ is now recognized. [bug introduced in parted-2.2]
+
+
* Noteworthy changes in release 2.3 (2010-05-28) [stable]
** New features
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index d9e7d4a..578180b 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1713,13 +1713,13 @@ _primary_constraint (const PedDisk* disk, const PedCHSGeometry* bios_geom,
dev->length - min_geom->end))
return NULL;
} else {
- /* Do not assume that length is larger than 1 cylinder's
- worth of sectors. This is useful when testing with
- a memory-mapped "disk" (a la scsi_debug) that is say,
- 2048 sectors long. */
- if (cylinder_size < dev->length
- && !ped_geometry_init (&start_geom, dev, cylinder_size,
- dev->length - cylinder_size))
+ /* Use cylinder_size as the starting sector number
+ when the device is large enough to accommodate that.
+ Otherwise, use sector 1. */
+ PedSector start = (cylinder_size < dev->length
+ ? cylinder_size : 1);
+ if (!ped_geometry_init (&start_geom, dev, start,
+ dev->length - start))
return NULL;
if (!ped_geometry_init (&end_geom, dev, 0, dev->length))
return NULL;
More information about the Parted-commits
mailing list