hal/libhal libhal.c,1.50,1.51

David Zeuthen david at freedesktop.org
Tue Jul 12 08:02:27 PDT 2005


Update of /cvs/hal/hal/libhal
In directory gabe:/tmp/cvs-serv28637/libhal

Modified Files:
	libhal.c 
Log Message:
2005-07-12  David Zeuthen  <davidz at redhat.com>

        * libhal/libhal.c (libhal_ctx_init): Make init fail if hald is
        actually not running



Index: libhal.c
===================================================================
RCS file: /cvs/hal/hal/libhal/libhal.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- libhal.c	8 Jul 2005 23:02:29 -0000	1.50
+++ libhal.c	12 Jul 2005 15:02:25 -0000	1.51
@@ -2868,6 +2868,7 @@
 libhal_ctx_init (LibHalContext *ctx, DBusError *error)
 {
 	DBusError _error;
+	dbus_bool_t hald_exists;
 
 	if (ctx == NULL)
 		return FALSE;
@@ -2875,12 +2876,22 @@
 	if (ctx->connection == NULL)
 		return FALSE;
 
+	dbus_error_init (&_error);
+	hald_exists = dbus_bus_name_has_owner (ctx->connection, "org.freedesktop.Hal", &_error);
+	dbus_move_error (&_error, error);
+	if (error != NULL && dbus_error_is_set (error)) {
+		return FALSE;
+	}
+
+	if (!hald_exists) {
+		return FALSE;
+	}
+
 	
 	if (!dbus_connection_add_filter (ctx->connection, filter_func, ctx, NULL)) {
 		return FALSE;
 	}
 
-	dbus_error_init (&_error);
 	dbus_bus_add_match (ctx->connection, 
 			    "type='signal',"
 			    "interface='org.freedesktop.Hal.Manager',"




More information about the hal-commit mailing list