hal/hald hald_dbus.c,1.49,1.50

David Zeuthen david at freedesktop.org
Fri Jan 20 19:14:20 PST 2006


Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv17416/hald

Modified Files:
	hald_dbus.c 
Log Message:
2006-01-20  David Zeuthen  <davidz at redhat.com>

        * hald/hald_dbus.c (device_query_capability): Yesterday while unit
        testing my HAL wrapper I noticed that calling QueryCapability make
        hald to quit. I looked at hald code and found the issues, you'll
        find a patch attached that makes QueryCapability to work correctly
        again. Basically it wasn't able to retrieve the capability
        list (string vs string list) and the requested capability was
        free'd when it shouldn't. Patch from Kevin Ottens <ervin at kde.org>.



Index: hald_dbus.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- hald_dbus.c	21 Jan 2006 02:45:27 -0000	1.49
+++ hald_dbus.c	21 Jan 2006 03:14:18 -0000	1.50
@@ -1541,7 +1541,7 @@
 {
 	dbus_bool_t rc;
 	const char *udi;
-	const char *caps;
+	GSList *caps;
 	char *capability;
 	HalDevice *d;
 	DBusMessage *reply;
@@ -1574,23 +1574,18 @@
 		DIE (("No memory"));
 
 	rc = FALSE;
-	caps = hal_device_property_get_string (d, "info.capabilities");
+	caps = hal_device_property_get_strlist (d, "info.capabilities");
 	if (caps != NULL) {
-		char **capsv, **iter;
+		GSList *iter;
 
-		capsv = g_strsplit (caps, " ", 0);
-		for (iter = capsv; *iter != NULL; iter++) {
-			if (strcmp (*iter, capability) == 0) {
+		for (iter = caps; iter != NULL; iter=g_slist_next(iter)) {
+			if (strcmp (iter->data, capability) == 0) {
 				rc = TRUE;
 				break;
 			}
 		}
-
-		g_strfreev (capsv);
 	}
 
-	dbus_free (capability);
-
 	dbus_message_iter_init_append (reply, &iter);
 	dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &rc);
 




More information about the hal-commit mailing list