mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-05 15:47:15 +08:00
31 lines
742 B
Diff
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;
|
|
}
|
|
|
|
/**
|