X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fdbus-unit.c;h=b5daa66b5d4b7032db623bfdddb185381eed6f97;hb=4ac9236fa14696db3e8a650a083a238eca9b9ae9;hp=835eeda3292494b06bffaf623024eb235c074e13;hpb=9a60da2834074d970ca063c210fe9d2f05c70532;p=elogind.git diff --git a/src/dbus-unit.c b/src/dbus-unit.c index 835eeda32..b5daa66b5 100644 --- a/src/dbus-unit.c +++ b/src/dbus-unit.c @@ -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); }