Blame SOURCES/0038-partprobe-Open-the-device-once-for-probing.patch

0cb0b9
From f3cbda4bf581b407586f24c980cf2e5a9cb2b4b2 Mon Sep 17 00:00:00 2001
0cb0b9
From: "Brian C. Lane" <bcl@redhat.com>
0cb0b9
Date: Wed, 25 May 2016 09:00:04 -0700
0cb0b9
Subject: [PATCH 38/38] partprobe: Open the device once for probing
0cb0b9
0cb0b9
Previously there were 3 open/close pairs for the device, which may
0cb0b9
result in triggering extra udev actions. Instead, open it once at the
0cb0b9
start of process_dev and close it at the end.
0cb0b9
---
0cb0b9
 partprobe/partprobe.c | 5 +++++
0cb0b9
 1 file changed, 5 insertions(+)
0cb0b9
0cb0b9
diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
0cb0b9
index 34997fe..8f2190b 100644
0cb0b9
--- a/partprobe/partprobe.c
0cb0b9
+++ b/partprobe/partprobe.c
0cb0b9
@@ -105,6 +105,9 @@ process_dev (PedDevice* dev)
0cb0b9
 	PedDiskType*	disk_type;
0cb0b9
 	PedDisk*	disk;
0cb0b9
 
0cb0b9
+	if (!ped_device_open (dev))
0cb0b9
+		return 0;
0cb0b9
+
0cb0b9
 	disk_type = ped_disk_probe (dev);
0cb0b9
 	if (!disk_type) {
0cb0b9
 		/* Partition table not found, so create dummy,
0cb0b9
@@ -128,11 +131,13 @@ process_dev (PedDevice* dev)
0cb0b9
 	if (opt_summary)
0cb0b9
 		summary (disk);
0cb0b9
 	ped_disk_destroy (disk);
0cb0b9
+	ped_device_close (dev);
0cb0b9
 	return 1;
0cb0b9
 
0cb0b9
 error_destroy_disk:
0cb0b9
 	ped_disk_destroy (disk);
0cb0b9
 error:
0cb0b9
+	ped_device_close (dev);
0cb0b9
 	return 0;
0cb0b9
 }
0cb0b9
 
0cb0b9
-- 
0cb0b9
2.5.5
0cb0b9