On Thu, 06.11.14 18:09, Vito Caputo (vito.cap...@coreos.com) wrote: > > + r = sd_bus_message_read(message, "i", &m->exit_retval); > + if (r < 0) > + return r; > + > m->exit_code = MANAGER_EXIT; > > return sd_bus_reply_method_return(message, NULL); > @@ -1918,7 +1922,7 @@ const sd_bus_vtable bus_manager_vtable[] = { > SD_BUS_METHOD("RemoveSnapshot", "s", NULL, method_remove_snapshot, > 0), > SD_BUS_METHOD("Reload", NULL, NULL, method_reload, > SD_BUS_VTABLE_UNPRIVILEGED), > SD_BUS_METHOD("Reexecute", NULL, NULL, method_reexecute, > SD_BUS_VTABLE_UNPRIVILEGED), > - SD_BUS_METHOD("Exit", NULL, NULL, method_exit, 0), > + SD_BUS_METHOD("Exit", "i", NULL, method_exit, 0),
I am not opposed to having this, but the bus interfaces are API we cannot just change signatures of the calls. Please add a new call ExitWithCode() or so as an alternative call with exit code. > @@ -4875,6 +4875,22 @@ static int daemon_reload(sd_bus *bus, char **args) { > if (r < 0) > return bus_log_create_error(r); > > + if (streq(method, "Exit")) { > + int retval = EXIT_SUCCESS; > + > + if (strv_length(args) > 1) { > + r = safe_atoi(args[1], &retval); > + if (r < 0) { > + log_error("Invalid exit status: %s", > strerror(-r)); > + return -EINVAL; > + } > + } > + > + r = sd_bus_message_append(m, "i", retval); > + if (r < 0) > + return bus_log_create_error(r); > + } This check really needs to be within the if block that checks if arg_action is ACTION_SYSTEMCTL (the one with the assert). The parameter should only be parsed if we are invoked as "systemctl", not as any of the other symlinked tools like "reboot" or so (not that we'd expose Exit() in those other tools, but please let's keep this clean). Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel