- ped_partition_is_busy() should not throw exceptions (#527035)

- msdos_partition_is_flag_available() should return 1 for swap flag
    (#513729)
This commit is contained in:
Hans de Goede 2009-10-06 18:53:21 +00:00
parent d8621345e2
commit 788f613dc1
3 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From fa2ad81437541251d6e47eccf3bc413cf68a0c31 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 6 Oct 2009 11:18:25 +0200
Subject: [PATCH] ped_partition_busy should not call the libparted exception handler
Modify libparted/arch/linux.c _partition_get_part_dev() to not call
_device_stat() but instead use stat directly, as _device_stat() calls
the libparted exception handler and we don't want this here, the only caller
of _partition_get_part_dev() is _partition_is_mounted(), which in turn only
gets called by linux_partition_is_busy(), and we don't want to "throw"
exceptions from ped_partition_busy()
This issue was noticed in combination with pyparted as used by anaconda, see:
https://bugzilla.redhat.com/show_bug.cgi?id=527035#c10
---
libparted/arch/linux.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 52f7d21..a8d6daf 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2127,7 +2127,7 @@ _partition_get_part_dev (const PedPartition* part)
struct stat dev_stat;
int dev_major, dev_minor;
- if (!_device_stat (part->disk->dev, &dev_stat))
+ if (stat (part->disk->dev->path, &dev_stat))
return (dev_t)0;
dev_major = major (dev_stat.st_rdev);
dev_minor = minor (dev_stat.st_rdev);
@@ -2184,6 +2184,8 @@ _partition_is_mounted (const PedPartition *part)
if (!ped_partition_is_active (part))
return 0;
dev = _partition_get_part_dev (part);
+ if (!dev)
+ return 0;
return _partition_is_mounted_by_dev (dev);
}
--
1.6.5.rc2

View File

@ -124,6 +124,14 @@ index 7ec15ee..f8307c5 100644
default:
return 0;
}
@@ -1496,6 +1496,7 @@ msdos_partition_is_flag_available (const
case PED_PARTITION_LBA:
case PED_PARTITION_PALO:
case PED_PARTITION_PREP:
+ case PED_PARTITION_SWAP:
return 1;
default:
--
1.6.0.6

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 1.9.0
Release: 14%{?dist}
Release: 15%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -25,6 +25,7 @@ Patch12: %{name}-1.9.0-volkeysize.patch
Patch13: %{name}-1.9.0-no-BLKPG.patch
Patch14: %{name}-1.9.0-commit-without-close.patch
Patch15: %{name}-1.9.0-dont-touch-part-nodes.patch
Patch16: %{name}-1.9.0-ped_partition_is_busy-no-exception.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -77,6 +78,7 @@ Parted library, you need to install this package.
%patch13 -p1 -b .no-BLKPG
%patch14 -p1 -b .commit-without-close
%patch15 -p1 -b .dont-touch-part-nodes
%patch16 -p1 -b .ped_partition_is_busy
%build
@ -101,6 +103,7 @@ popd
%{__rm} -rf %{buildroot}%{_libdir}/*.la
%{__rm} -rf %{buildroot}%{_infodir}/dir
%{__rm} -rf %{buildroot}%{_bindir}/label
%{__rm} -rf %{buildroot}%{_bindir}/disk
%find_lang %{name}
@ -137,6 +140,10 @@ fi
%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc
%changelog
* Tue Oct 6 2009 Hans de Goede <hdegoede@redhat.com> 1.9.0-15
- ped_partition_is_busy() should not throw exceptions (#527035)
- msdos_partition_is_flag_available() should return 1 for swap flag (#513729)
* Mon Aug 31 2009 Joel Granados <jgranado@redhat.com> 1.9.0-14
- Patchs for 'commit to os' for linux. Thx to hansg.