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

fc4a62
From c34f2e31d804d70332b8be9760ea3f285d480070 Mon Sep 17 00:00:00 2001
fc4a62
From: "Brian C. Lane" <bcl@redhat.com>
fc4a62
Date: Wed, 25 May 2016 09:00:04 -0700
fc4a62
Subject: [PATCH] partprobe: Open the device once for probing (#1339705)
fc4a62
fc4a62
Previously there were 3 open/close pairs for the device, which may
fc4a62
result in triggering extra udev actions. Instead, open it once at the
fc4a62
start of process_dev and close it at the end.
fc4a62
fc4a62
Resolves: rhbz#1339705
fc4a62
---
fc4a62
 partprobe/partprobe.c | 5 +++++
fc4a62
 1 file changed, 5 insertions(+)
fc4a62
fc4a62
diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
fc4a62
index 8bccc4f..c5260c6 100644
fc4a62
--- a/partprobe/partprobe.c
fc4a62
+++ b/partprobe/partprobe.c
fc4a62
@@ -108,6 +108,9 @@ process_dev (PedDevice* dev)
fc4a62
 	PedDiskType*	disk_type;
fc4a62
 	PedDisk*	disk;
fc4a62
 
fc4a62
+	if (!ped_device_open (dev))
fc4a62
+		return 0;
fc4a62
+
fc4a62
 	disk_type = ped_disk_probe (dev);
fc4a62
 	if (!disk_type || !strcmp (disk_type->name, "loop"))
fc4a62
 		return 1;
fc4a62
@@ -122,11 +125,13 @@ process_dev (PedDevice* dev)
fc4a62
 	if (opt_summary)
fc4a62
 		summary (disk);
fc4a62
 	ped_disk_destroy (disk);
fc4a62
+	ped_device_close (dev);
fc4a62
 	return 1;
fc4a62
 
fc4a62
 error_destroy_disk:
fc4a62
 	ped_disk_destroy (disk);
fc4a62
 error:
fc4a62
+	ped_device_close (dev);
fc4a62
 	return 0;
fc4a62
 }
fc4a62
 
fc4a62
-- 
fc4a62
2.5.5
fc4a62