From b8f160a8001a61b38e1dea5266f6b54551cb1290 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 30 Oct 2009 11:58:36 +0000 Subject: [PATCH] - Fix a segfault introduced by -18 when operating on plain files --- parted-1.9.0-export-alignment-info.patch | 19 ++++++++++++++----- parted.spec | 5 ++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/parted-1.9.0-export-alignment-info.patch b/parted-1.9.0-export-alignment-info.patch index f44fc0f..4e10d3e 100644 --- a/parted-1.9.0-export-alignment-info.patch +++ b/parted-1.9.0-export-alignment-info.patch @@ -102,7 +102,7 @@ diff -up parted-1.9.0/libparted/Makefile.am.export-align parted-1.9.0/libparted/ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted/arch/linux.c --- parted-1.9.0/libparted/arch/linux.c.export-align 2009-10-29 15:19:31.000000000 +0100 +++ parted-1.9.0/libparted/arch/linux.c 2009-10-29 15:22:59.000000000 +0100 -@@ -598,7 +598,26 @@ _have_kern26 () +@@ -598,7 +598,24 @@ _have_kern26 () kver = _get_linux_version(); return have_kern26 = kver >= KERNEL_VERSION (2,6,0) ? 1 : 0; } @@ -112,8 +112,6 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted +static void +get_blkid_topology (LinuxSpecific *arch_specific) +{ -+ arch_specific->topology = NULL; -+ + arch_specific->probe = blkid_new_probe (); + if (!arch_specific->probe) + return; @@ -140,6 +138,17 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted /* Return PED_SECTOR_SIZE_DEFAULT for DASDs. */ if (dev->type == PED_DEVICE_DASD) { dev->sector_size = PED_SECTOR_SIZE_DEFAULT; +@@ -1237,6 +1235,10 @@ linux_new (const char* path) + goto error_free_path; + arch_specific = LINUX_SPECIFIC (dev); + arch_specific->dmtype = NULL; ++#if USE_BLKID ++ arch_specific->probe = NULL; ++ arch_specific->topology = NULL; ++#endif + + dev->open_count = 0; + dev->read_only = 0; @@ -1335,7 +1357,12 @@ error: static void linux_destroy (PedDevice* dev) @@ -164,7 +173,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted +{ + blkid_topology tp = LINUX_SPECIFIC(dev)->topology; + -+ if (!tp) ++ if (!tp || blkid_topology_get_minimum_io_size(tp) == 0) + return NULL; /* ped_alignment_none */ + + return ped_alignment_new( @@ -177,7 +186,7 @@ diff -up parted-1.9.0/libparted/arch/linux.c.export-align parted-1.9.0/libparted +{ + blkid_topology tp = LINUX_SPECIFIC(dev)->topology; + -+ if (!tp) ++ if (!tp || blkid_topology_get_optimal_io_size(tp) == 0) + return NULL; /* ped_alignment_none */ + + return ped_alignment_new( diff --git a/parted.spec b/parted.spec index 717c786..601aec6 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 1.9.0 -Release: 18%{?dist} +Release: 19%{?dist} License: GPLv3+ Group: Applications/System URL: http://www.gnu.org/software/parted @@ -148,6 +148,9 @@ fi %{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc %changelog +* Fri Oct 30 2009 Hans de Goede 1.9.0-19 +- Fix a segfault introduced by -18 when operating on plain files + * Thu Oct 29 2009 Hans de Goede 1.9.0-18 - Add functions to query device / partition table alignments (#528030)