summaryrefslogtreecommitdiffstats
path: root/source/l/hal/patches/fix_segfault_in_mdraid.diff
blob: 88e5eaf63a4822fe8ee2bca805efe3ab5cef6a5f (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Author: Martin Poole <mpoole@redhat.com>
Date:   Wed Jul 29 14:20:45 2009 +0100

    Fix a segfault in the mdraid code -- see rh#507782 for more info
    
    Signed-off-by: Richard Hughes <richard@hughsie.com>

diff -Nur hal-0.5.11.orig/hald/linux/blockdev.c hal-0.5.11/hald/linux/blockdev.c
--- hal-0.5.11.orig/hald/linux/blockdev.c	2008-05-07 18:23:41.000000000 -0500
+++ hal-0.5.11/hald/linux/blockdev.c	2009-07-30 16:22:40.624837902 -0500
@@ -851,7 +851,7 @@
 }
 
 
-void
+
 hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_file, gboolean is_partition,
 				  HalDevice *parent, void *end_token)
 {
@@ -865,6 +865,7 @@
 	gboolean is_device_mapper;
         gboolean is_md_device;
         int md_number;
+	char tc;
 
 	is_device_mapper = FALSE;
         is_fakevolume = FALSE;
@@ -882,7 +883,7 @@
 		HAL_INFO (("Handling %s as fakevolume - sysfs_path_real=%s", device_file, sysfs_path_real));
 		is_fakevolume = TRUE;
 		sysfs_path_real = hal_util_get_parent_path (sysfs_path);
-        } else if (sscanf (hal_util_get_last_element (sysfs_path), "md%d", &md_number) == 1) {
+        } else if (sscanf (hal_util_get_last_element (sysfs_path), "md%d%c", &md_number, &tc) == 1) {
 		HAL_INFO (("Handling %s as MD device", device_file));
                 is_md_device = TRUE;
 		sysfs_path_real = g_strdup (sysfs_path);