- Fix a segfault introduced by -18 when operating on plain files

This commit is contained in:
Hans de Goede 2009-10-30 11:58:36 +00:00
parent 40d8282e48
commit b8f160a800
2 changed files with 18 additions and 6 deletions

View File

@ -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(

View File

@ -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 <hdegoede@redhat.com> 1.9.0-19
- Fix a segfault introduced by -18 when operating on plain files
* Thu Oct 29 2009 Hans de Goede <hdegoede@redhat.com> 1.9.0-18
- Add functions to query device / partition table alignments (#528030)