aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'hal-0.5.11-patches/0045-set-the-retval-of-hal-device-correctly-on-error.patch')
-rw-r--r--hal-0.5.11-patches/0045-set-the-retval-of-hal-device-correctly-on-error.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/hal-0.5.11-patches/0045-set-the-retval-of-hal-device-correctly-on-error.patch b/hal-0.5.11-patches/0045-set-the-retval-of-hal-device-correctly-on-error.patch
new file mode 100644
index 00000000..60cf881b
--- /dev/null
+++ b/hal-0.5.11-patches/0045-set-the-retval-of-hal-device-correctly-on-error.patch
@@ -0,0 +1,55 @@
+From 0d526db56322d39707afadcd1f4a5133b724287a Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard@hughsie.com>
+Date: Thu, 29 Jan 2009 08:34:16 +0000
+Subject: [PATCH 45/48] set the retval of hal-device correctly on error
+
+At the moment hal-device always returns success.
+Only return success if a device was matched.
+---
+ tools/hal-device.c | 9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+diff --git a/tools/hal-device.c b/tools/hal-device.c
+index e8bf348..38458a5 100644
+--- a/tools/hal-device.c
++++ b/tools/hal-device.c
+@@ -189,6 +189,7 @@ int dump_devices(LibHalContext *hal_ctx, char *arg)
+ {
+ int i;
+ int num_devices;
++ int retval;
+ char **device_names;
+ DBusError error;
+ char *udi = NULL;
+@@ -222,6 +223,9 @@ int dump_devices(LibHalContext *hal_ctx, char *arg)
+ num_devices = 1;
+ }
+
++ /* if _any_ device matches, we return success */
++ retval = 1;
++
+ for(i = 0; i < num_devices; i++) {
+ LibHalPropertySet *props;
+ LibHalPropertySetIterator it;
+@@ -233,6 +237,9 @@ int dump_devices(LibHalContext *hal_ctx, char *arg)
+ continue;
+ }
+
++ /* we got some properties */
++ retval = 0;
++
+ if (!udi)
+ printf("%d: ", i);
+ printf("udi = '%s'\n", device_names[i]);
+@@ -298,7 +305,7 @@ int dump_devices(LibHalContext *hal_ctx, char *arg)
+ libhal_free_string_array(device_names);
+ dbus_error_free(&error);
+
+- return 0;
++ return retval;
+ }
+
+
+--
+1.6.1.2
+