chiark / gitweb /
dbus: return DBUS_ERROR_UNKNOWN_OBJECT when an object is unknown
authorLennart Poettering <lennart@poettering.net>
Tue, 8 Mar 2011 01:27:43 +0000 (02:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 8 Mar 2011 01:27:43 +0000 (02:27 +0100)
src/dbus-job.c
src/dbus-unit.c
src/dbus.h

index 2a33039..e90d585 100644 (file)
@@ -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);
         }
index 835eeda..cd6ad84 100644 (file)
@@ -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);
         }
index 255b653..2aaeb47 100644 (file)
 
 #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);