X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fdbus-unit.c;h=812f1b9f1600c750efb71e25bd8b3ab86d3609f6;hb=49dbfa7b2b0bf3906704dac1eaeb4eba91056a19;hp=c7532c72552b4deae843c28229e6b35a05e8c625;hpb=b30e2f4c18ad81b04e4314fd191a5d458553773c;p=elogind.git diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index c7532c725..812f1b9f1 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -6,16 +6,16 @@ Copyright 2010 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -558,12 +558,15 @@ static DBusHandlerResult bus_unit_message_handler(DBusConnection *connection, DB Manager *m = data; Unit *u; int r; - DBusMessage *reply; + DBusMessage *reply = NULL; + DBusError error; assert(connection); assert(message); assert(m); + dbus_error_init(&error); + if (streq(dbus_message_get_path(message), "/org/freedesktop/systemd1/unit")) { /* Be nice to gdbus and return introspection data for our mid-level paths */ @@ -638,20 +641,12 @@ static DBusHandlerResult bus_unit_message_handler(DBusConnection *connection, DB return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - if ((r = manager_get_unit_from_dbus_path(m, dbus_message_get_path(message), &u)) < 0) { - + r = manager_load_unit_from_dbus_path(m, dbus_message_get_path(message), &error, &u); + if (r < 0) { if (r == -ENOMEM) - return DBUS_HANDLER_RESULT_NEED_MEMORY; - - 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(connection, message, &e, r); - } + goto oom; - return bus_send_error_reply(connection, message, NULL, r); + return bus_send_error_reply(connection, message, &error, r); } return bus_unit_message_dispatch(u, connection, message); @@ -660,6 +655,8 @@ oom: if (reply) dbus_message_unref(reply); + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_NEED_MEMORY; } @@ -810,6 +807,8 @@ const BusProperty bus_unit_properties[] = { { "TriggeredBy", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_TRIGGERED_BY]), true }, { "PropagateReloadTo", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_PROPAGATE_RELOAD_TO]), true }, { "PropagateReloadFrom", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_PROPAGATE_RELOAD_FROM]), true }, + { "RequiresMountsFor", bus_property_append_strv, "as", offsetof(Unit, requires_mounts_for), true }, + { "Documentation", bus_property_append_strv, "as", offsetof(Unit, documentation), true }, { "Description", bus_unit_append_description, "s", 0 }, { "LoadState", bus_unit_append_load_state, "s", offsetof(Unit, load_state) }, { "ActiveState", bus_unit_append_active_state, "s", 0 },