summaryrefslogtreecommitdiffstats
path: root/sysutils/hal/files/patch-hald_freebsd_hf-util.c
blob: 0d09ad3ae7cfe142eb47deb82395e4c9dd779fb7 (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
--- hald/freebsd/hf-util.c.orig 2008-03-15 14:27:25.000000000 -0400
+++ hald/freebsd/hf-util.c  2008-03-15 14:27:29.000000000 -0400
@@ -263,7 +263,7 @@ hf_device_set_udi (HalDevice *device, co
   udi = g_strdup_vprintf(format, args);
   va_end(args);
 
-  safe_str = hf_str_no_slashes(udi);
+  safe_str = hf_str_escape(udi);
   g_free(udi);
 
   hf_device_set_full_udi(device, "/org/freedesktop/Hal/devices/%s", safe_str);
@@ -675,14 +675,18 @@ hf_device_store_match (HalDeviceStore *s
 }
 
 char *
-hf_str_no_slashes (const char *str)
+hf_str_escape (const char *str)
 {
   char *safe_str;
 
   g_return_val_if_fail(str != NULL, NULL);
 
   safe_str = g_strdup(str);
-  safe_str = g_strdelimit(safe_str, "/", '_');
+  g_strcanon(safe_str,
+             "_"
+        "abcdefghijklmnopqrstuvwxyz"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+        "1234567890", '_');
 
   return safe_str;
 }