hal: Branch 'master'
Danny Kukawka
dkukawka at kemper.freedesktop.org
Tue Aug 7 05:42:37 PDT 2007
tools/hal-device.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
New commits:
diff-tree 91dfcc4763ad9cea8eb729eccec0b307144f5ecd (from 32975e1254efb7f21a1f011e5ec142706b38585e)
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Tue Aug 7 14:42:16 2007 +0200
fixed compiler warning about unused return value of asprintf()
Fixed compiler warning about unused return value of asprintf()
by check the value and exit if the function return with -1.
diff --git a/tools/hal-device.c b/tools/hal-device.c
index 5dd5d8b..e8bf348 100644
--- a/tools/hal-device.c
+++ b/tools/hal-device.c
@@ -198,7 +198,8 @@ int dump_devices(LibHalContext *hal_ctx,
udi = arg;
} else {
#ifdef HAVE_ASPRINTF
- asprintf(&udi, "/org/freedesktop/Hal/devices/%s", arg);
+ if (asprintf(&udi, "/org/freedesktop/Hal/devices/%s", arg) == -1)
+ return 30;
#else
udi = calloc(1, sizeof ("/org/freedesktop/Hal/devices/%s") + strlen(arg));
sprintf(udi, "/org/freedesktop/Hal/devices/%s", arg);
@@ -306,13 +307,14 @@ int remove_udi(LibHalContext *hal_ctx, c
DBusError error;
char *udi;
- if (!arg) return 11;
+ if (!arg) return 10;
if (*arg == '/') {
udi = arg;
} else {
#ifdef HAVE_ASPRINTF
- asprintf(&udi, "/org/freedesktop/Hal/devices/%s", arg);
+ if(asprintf(&udi, "/org/freedesktop/Hal/devices/%s", arg) == -1)
+ return 11;
#else
udi = calloc(1, sizeof ("/org/freedesktop/Hal/devices/%s") + strlen(arg));
sprintf(udi, "/org/freedesktop/Hal/devices/%s", arg);
@@ -346,13 +348,14 @@ int add_udi(LibHalContext *hal_ctx, char
int err;
if (!arg)
- return 21;
+ return 20;
if (*arg == '/') {
udi = arg;
} else {
#ifdef HAVE_ASPRINTF
- asprintf(&udi, "/org/freedesktop/Hal/devices/%s", arg);
+ if (asprintf(&udi, "/org/freedesktop/Hal/devices/%s", arg) == -1)
+ return 21;
#else
udi = calloc(1, sizeof ("/org/freedesktop/Hal/devices/%s") + strlen(arg));
sprintf(udi, "/org/freedesktop/Hal/devices/%s", arg);
More information about the hal-commit
mailing list