chiark / gitweb /
exec: support unlimited resources
[elogind.git] / src / dbus-unit.c
index 835eeda3292494b06bffaf623024eb235c074e13..b5daa66b5d4b7032db623bfdddb185381eed6f97 100644 (file)
@@ -37,8 +37,7 @@ const char bus_unit_interface[] _introspect_("Unit") = BUS_UNIT_INTERFACE;
         "ActiveExitTimestamp\0"                 \
         "InactiveEnterTimestamp\0"              \
         "Job\0"                                 \
-        "NeedDaemonReload\0"                    \
-        "\0"
+        "NeedDaemonReload\0"
 
 int bus_unit_append_names(Manager *m, DBusMessageIter *i, const char *property, void *data) {
         char *t;
@@ -456,8 +455,6 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *conn
                         goto oom;
         }
 
-        free(path);
-
         if (reply) {
                 if (!dbus_connection_send(connection, reply, NULL))
                         goto oom;
@@ -465,6 +462,8 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *conn
                 dbus_message_unref(reply);
         }
 
+        free(path);
+
         return DBUS_HANDLER_RESULT_HANDLED;
 
 oom:
@@ -567,8 +566,13 @@ 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_error_init(&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);
         }