X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsystemctl.c;h=429d6a7a21440cf5bb13c55f0140428da36ef32c;hb=f5a3628cc7aa132bb0ee6be48f3cedc2d8838046;hp=68e4a909eb6e4b8cc586ba6661ca30277f68af0e;hpb=e4a9373fb3ddeadd6b847449186fadf5963695f7;p=elogind.git diff --git a/src/systemctl.c b/src/systemctl.c index 68e4a909e..429d6a7a2 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -1465,7 +1465,7 @@ static int halt_help(void) { static int shutdown_help(void) { - printf("%s [options] [IGNORED] [WALL...]\n\n" + printf("%s [options] [now] [WALL...]\n\n" "Shut down the system.\n\n" " --help Show this help\n" " -H --halt Halt the machine\n" @@ -1741,6 +1741,9 @@ static int shutdown_parse_argv(int argc, char *argv[]) { } } + if (argc > optind && !streq(argv[optind], "now")) + log_warning("First argument '%s' isn't 'now'. Ignoring.", argv[optind]); + /* We ignore the time argument */ if (argc > optind + 1) arg_wall = argv + optind + 1; @@ -1748,7 +1751,6 @@ static int shutdown_parse_argv(int argc, char *argv[]) { optind = argc; return 1; - } static int telinit_parse_argv(int argc, char *argv[]) { @@ -2259,7 +2261,13 @@ int main(int argc, char*argv[]) { goto finish; } - if ((bus = dbus_bus_get(arg_session ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error))) + /* If we are root, then let's not go via the bus */ + if (geteuid() == 0 && !arg_session) + bus = dbus_connection_open("unix:abstract=/org/freedesktop/systemd1/private", &error); + else + bus = dbus_bus_get(arg_session ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error); + + if (bus) dbus_connection_set_exit_on_disconnect(bus, FALSE); switch (arg_action) {