hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue Jul 3 03:22:48 PDT 2007


 hald/linux/blockdev.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

New commits:
diff-tree 2d1d72e8c9f3ff0ed4fc9e3147aacc607f250f39 (from b11bf7d875ae74a6f4f402d5a2d4d264abc7bdbb)
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Jul 3 12:21:15 2007 +0200

    replace '/' in volume labels with '_' if part of UDI
    
    This fixes fd.o #11401 by replacing '/' in volume labels with '_' if they
    get part of the UDI. This should avoid trouble with D-Bus.

diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index e2f9574..f1605ec 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -67,16 +67,21 @@ blockdev_compute_udi (HalDevice *d)
 	if (hal_device_property_get_bool (d, "block.is_volume")) {
 		const char *label;
 		const char *uuid;
+		char *volumelabel;
 
 		label = hal_device_property_get_string (d, "volume.label");
+	        /* replace '/'  to avoid trouble if the string get part of the UDI see fd.o #11401 */
+		volumelabel = g_strdup(label);
+	        volumelabel = g_strdelimit (volumelabel, "/", '_');
+
 		uuid = hal_device_property_get_string (d, "volume.uuid");
 
 		if (uuid != NULL && strlen (uuid) > 0) {
 			hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
 					      "/org/freedesktop/Hal/devices/volume_uuid_%s", uuid);
-		} else if (label != NULL && strlen (label) > 0) {
+		} else if (volumelabel != NULL && strlen (volumelabel) > 0) {
 			hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-					      "/org/freedesktop/Hal/devices/volume_label_%s", label);
+					      "/org/freedesktop/Hal/devices/volume_label_%s", volumelabel);
 		} else if (hal_device_property_get_bool(d, "volume.is_disc") &&
 			   hal_device_property_get_bool(d, "volume.disc.is_blank")) {
 			/* this should be a empty CD/DVD */


More information about the hal-commit mailing list