summaryrefslogtreecommitdiff
path: root/config/dbus.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-08-30 18:20:20 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-08-31 15:03:02 +0930
commit0fcde83d94507eadd9f99d4e6a63584b221c989c (patch)
treed5d0308f91e1676476ff967f35c742ab17d140b7 /config/dbus.c
parent87495fc7064d5e0a7575a0713b6895a4172df0fa (diff)
config: return BadValue to caller if add/remove doesn't have parameters.
If message iterator cannot be created, the caller didn't supply any parameters. Return BadValue, instead of dying a horrible death while being stuck in an endless loop.
Diffstat (limited to 'config/dbus.c')
-rw-r--r--config/dbus.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/config/dbus.c b/config/dbus.c
index c6f4af0d5..d43799448 100644
--- a/config/dbus.c
+++ b/config/dbus.c
@@ -74,11 +74,12 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
int ret, err;
DeviceIntPtr dev = NULL;
+ dbus_message_iter_init_append(reply, &reply_iter);
+
if (!dbus_message_iter_init(message, &iter)) {
ErrorF("[config/dbus] couldn't initialise iterator\n");
- return BadAlloc;
+ MALFORMED_MESSAGE();
}
- dbus_message_iter_init_append(reply, &reply_iter);
options = xcalloc(sizeof(*options), 1);
if (!options) {
@@ -200,11 +201,12 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
DeviceIntPtr dev;
DBusMessageIter iter, reply_iter;
+ dbus_message_iter_init_append(reply, &reply_iter);
+
if (!dbus_message_iter_init(message, &iter)) {
ErrorF("[config] failed to init iterator\n");
- return BadAlloc;
+ MALFORMED_MESSAGE();
}
- dbus_message_iter_init_append(reply, &reply_iter);
if (!dbus_message_get_args(message, error, DBUS_TYPE_UINT32,
&deviceid, DBUS_TYPE_INVALID)) {