Hi Martin,

the HAL scanner code doesn't correctly initialize the HAL context it
uses. This causes the libchipcard HAL scanner to not fail if the HAL
daemon isn't running. This in turn causes ugly error messages like those
reported in the following two bug reports:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532893
https://bugs.launchpad.net/debian/+source/libchipcard/+bug/429853

The attached patch fixes this issue and enables libchipcard's
HAL scanner to correctly detect whether HAL is running or not.

Regards
  Micha
Index: src/lib/server/common/halscanner.c
===================================================================
--- src/lib/server/common/halscanner.c	(revision 529)
+++ src/lib/server/common/halscanner.c	(working copy)
@@ -69,8 +69,18 @@
     return NULL;
   }
 
-  libhal_ctx_set_dbus_connection(xsc->ctx, xsc->dbus_conn);
+  if (!libhal_ctx_set_dbus_connection(xsc->ctx, xsc->dbus_conn)) {
+    DBG_ERROR(0, "Failed to set dbus connection for HAL context (is the HAL daemon running?)");
+    LC_DevScanner_free(sc);
+    return NULL;
+  }
 
+  if (!libhal_ctx_init(xsc->ctx, &(xsc->dbus_error))) {
+    DBG_ERROR(0, "Failed to initialize HAL context (is the HAL daemon running?)");
+    LC_DevScanner_free(sc);
+    return NULL;
+  }
+
   return sc;
 }
 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to