aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'hal-0.5.11-patches/0044-check-udi-in-hal-get-property.patch')
-rw-r--r--hal-0.5.11-patches/0044-check-udi-in-hal-get-property.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/hal-0.5.11-patches/0044-check-udi-in-hal-get-property.patch b/hal-0.5.11-patches/0044-check-udi-in-hal-get-property.patch
new file mode 100644
index 00000000..7401a9bb
--- /dev/null
+++ b/hal-0.5.11-patches/0044-check-udi-in-hal-get-property.patch
@@ -0,0 +1,47 @@
+From b0a511392a712b89017bd3dbf7b1c17d25c9df3c Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard@hughsie.com>
+Date: Thu, 29 Jan 2009 08:33:00 +0000
+Subject: [PATCH 44/48] check udi in hal-get-property
+
+We are not checking if a UDI is valid in hal-get-property
+which means getting a horrible DBUS error if the entry
+is not a valid DBUS path.
+---
+ tools/hal_get_property.c | 14 ++++++++++++++
+ 1 files changed, 14 insertions(+), 0 deletions(-)
+
+diff --git a/tools/hal_get_property.c b/tools/hal_get_property.c
+index ecaa6ce..d31261a 100644
+--- a/tools/hal_get_property.c
++++ b/tools/hal_get_property.c
+@@ -84,6 +84,7 @@ main (int argc, char *argv[])
+ dbus_bool_t is_hex = FALSE;
+ dbus_bool_t is_verbose = FALSE;
+ dbus_bool_t is_version = FALSE;
++ dbus_bool_t udi_exists;
+ char *str;
+ DBusError error;
+
+@@ -168,6 +169,19 @@ main (int argc, char *argv[])
+ return 1;
+ }
+
++ /* check UDI exists */
++ udi_exists = libhal_device_exists (hal_ctx, udi, &error);
++ if (!udi_exists) {
++ fprintf (stderr, "error: UDI %s does not exist\n", udi);
++ return 1;
++ }
++ if (dbus_error_is_set(&error)) {
++ fprintf (stderr, "error: libhal_device_exists: %s: %s\n", error.name, error.message);
++ LIBHAL_FREE_DBUS_ERROR (&error);
++ return 1;
++ }
++
++ /* get type */
+ type = libhal_device_get_property_type (hal_ctx, udi, key, &error);
+ if (type == LIBHAL_PROPERTY_TYPE_INVALID) {
+ fprintf (stderr, "error: libhal_device_get_property_type: %s: %s\n", error.name, error.message);
+--
+1.6.1.2
+