core/parted/parted-1.9.0.patch
2010-05-21 22:07:29 +00:00

31 lines
742 B
Diff

--- a/libparted/disk.c 2009-07-23 10:52:08.000000000 -0700
+++ b/libparted/disk.c 2009-12-02 23:53:24.000000000 -0800
@@ -489,9 +489,25 @@
int
ped_disk_commit (PedDisk* disk)
{
+ /* Open the device here, so that the underlying fd is not closed
+ between commit_to_dev and commit_to_os (closing causes unwanted
+ udev events to be sent under Linux). */
+ if (!ped_device_open (disk->dev))
+ goto error;
+
if (!ped_disk_commit_to_dev (disk))
- return 0;
- return ped_disk_commit_to_os (disk);
+ goto error_close_dev;
+
+ if (!ped_disk_commit_to_os (disk))
+ goto error_close_dev;
+
+ ped_device_close (disk->dev);
+ return 1;
+
+error_close_dev:
+ ped_device_close (disk->dev);
+error:
+ return 0;
}
/**