diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-03-08 02:27:43 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-03-08 02:27:43 +0100 |
commit | 08672cb5071af320127f6fe8d0916f62bedd82f3 (patch) | |
tree | d91cc733ba11fe57de18901ce584e325489ad23b /src | |
parent | 83310f162d2a78913b2748aaa5ffb1ae8226484f (diff) |
dbus: return DBUS_ERROR_UNKNOWN_OBJECT when an object is unknown
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus-job.c | 7 | ||||
-rw-r--r-- | src/dbus-unit.c | 7 | ||||
-rw-r--r-- | src/dbus.h | 8 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/dbus-job.c b/src/dbus-job.c index 2a33039bdb..e90d585b63 100644 --- a/src/dbus-job.c +++ b/src/dbus-job.c @@ -193,8 +193,11 @@ static DBusHandlerResult bus_job_message_handler(DBusConnection *connection, DBu if (r == -ENOMEM) return DBUS_HANDLER_RESULT_NEED_MEMORY; - if (r == -ENOENT) - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + if (r == -ENOENT) { + DBusError e; + dbus_set_error_const(&e, DBUS_ERROR_UNKNOWN_OBJECT, "Unknown job"); + return bus_send_error_reply(m, connection, message, &e, r); + } return bus_send_error_reply(m, connection, message, NULL, r); } diff --git a/src/dbus-unit.c b/src/dbus-unit.c index 835eeda329..cd6ad843f9 100644 --- a/src/dbus-unit.c +++ b/src/dbus-unit.c @@ -567,8 +567,11 @@ static DBusHandlerResult bus_unit_message_handler(DBusConnection *connection, DB if (r == -ENOMEM) return DBUS_HANDLER_RESULT_NEED_MEMORY; - if (r == -ENOENT) - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + if (r == -ENOENT) { + DBusError e; + dbus_set_error_const(&e, DBUS_ERROR_UNKNOWN_OBJECT, "Unknown unit"); + return bus_send_error_reply(m, connection, message, &e, r); + } return bus_send_error_reply(m, connection, message, NULL, r); } diff --git a/src/dbus.h b/src/dbus.h index 255b653376..2aaeb4745f 100644 --- a/src/dbus.h +++ b/src/dbus.h @@ -24,6 +24,14 @@ #include <dbus/dbus.h> +#ifndef DBUS_ERROR_UNKNOWN_OBJECT +#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject" +#endif + +#ifndef DBUS_ERROR_UNKNOWN_INTERFACE +#define DBUS_ERROR_UNKNOWN_INTERFACE "org.freedesktop.DBus.Error.UnknownInterface" +#endif + #include "manager.h" typedef int (*BusPropertyCallback)(Manager *m, DBusMessageIter *iter, const char *property, void *data); |