[parted-devel] [PATCH] partprobe: Open the device once for probing
Brian C. Lane
bcl at redhat.com
Wed May 25 16:40:58 UTC 2016
Previously there were 3 open/close pairs for the device, which may
result in triggering extra udev actions. Instead, open it once at the
start of process_dev and close it at the end.
---
partprobe/partprobe.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
index 34997fe..8f2190b 100644
--- a/partprobe/partprobe.c
+++ b/partprobe/partprobe.c
@@ -105,6 +105,9 @@ process_dev (PedDevice* dev)
PedDiskType* disk_type;
PedDisk* disk;
+ if (!ped_device_open (dev))
+ return 0;
+
disk_type = ped_disk_probe (dev);
if (!disk_type) {
/* Partition table not found, so create dummy,
@@ -128,11 +131,13 @@ process_dev (PedDevice* dev)
if (opt_summary)
summary (disk);
ped_disk_destroy (disk);
+ ped_device_close (dev);
return 1;
error_destroy_disk:
ped_disk_destroy (disk);
error:
+ ped_device_close (dev);
return 0;
}
--
2.5.5
More information about the parted-devel
mailing list