]> git.pld-linux.org Git - packages/parted.git/blob - 0038-partprobe-Open-the-device-once-for-probing.patch
- rel 4; tons of patches from FC
[packages/parted.git] / 0038-partprobe-Open-the-device-once-for-probing.patch
1 From f3cbda4bf581b407586f24c980cf2e5a9cb2b4b2 Mon Sep 17 00:00:00 2001
2 From: "Brian C. Lane" <bcl@redhat.com>
3 Date: Wed, 25 May 2016 09:00:04 -0700
4 Subject: [PATCH 38/38] partprobe: Open the device once for probing
5
6 Previously there were 3 open/close pairs for the device, which may
7 result in triggering extra udev actions. Instead, open it once at the
8 start of process_dev and close it at the end.
9 ---
10  partprobe/partprobe.c | 5 +++++
11  1 file changed, 5 insertions(+)
12
13 diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
14 index 34997fe..8f2190b 100644
15 --- a/partprobe/partprobe.c
16 +++ b/partprobe/partprobe.c
17 @@ -105,6 +105,9 @@ process_dev (PedDevice* dev)
18         PedDiskType*    disk_type;
19         PedDisk*        disk;
20  
21 +       if (!ped_device_open (dev))
22 +               return 0;
23 +
24         disk_type = ped_disk_probe (dev);
25         if (!disk_type) {
26                 /* Partition table not found, so create dummy,
27 @@ -128,11 +131,13 @@ process_dev (PedDevice* dev)
28         if (opt_summary)
29                 summary (disk);
30         ped_disk_destroy (disk);
31 +       ped_device_close (dev);
32         return 1;
33  
34  error_destroy_disk:
35         ped_disk_destroy (disk);
36  error:
37 +       ped_device_close (dev);
38         return 0;
39  }
40  
41 -- 
42 2.5.5
43
This page took 0.050013 seconds and 3 git commands to generate.