Bug#532893: [PATCH] Fehlende Initialisierung des HAL-Kontexts

Micha Lenk <[email protected]> Wed, 02 Dec 2009 17:25:44 +0100
Newsgroups gmane.comp.lib.libchipcard.devel,gmane.linux.debian.devel.bugs.general
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig738C02D70A334DEE1C711C2F
Content-Type: multipart/mixed;
 boundary="------------070904020307030107080802"

This is a multi-part message in MIME format.
--------------070904020307030107080802
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

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=3D532893
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

--------------070904020307030107080802
Content-Type: text/x-patch;
 name="missing_HAL_ctx_initialization.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="missing_HAL_ctx_initialization.patch"

Index: src/lib/server/common/halscanner.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/lib/server/common/halscanner.c	(revision 529)
+++ src/lib/server/common/halscanner.c	(working copy)
@@ -69,8 +69,18 @@
     return NULL;
   }
=20
-  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;
+  }
=20
+  if (!libhal_ctx_init(xsc->ctx, &(xsc->dbus_error))) {
+    DBG_ERROR(0, "Failed to initialize HAL context (is the HAL daemon ru=
nning?)");
+    LC_DevScanner_free(sc);
+    return NULL;
+  }
+
   return sc;
 }
=20

--------------070904020307030107080802--

--------------enig738C02D70A334DEE1C711C2F
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksWlQ4ACgkQWN0/4pnhQbQ7LACg1+Xs7EDg51ryc5VdrK3lbh07
eEAAoMBDQBeoPHhkqjZecf89gw8sLZ/H
=djbY
-----END PGP SIGNATURE-----

--------------enig738C02D70A334DEE1C711C2F--