mirror of
https://github.com/systemd/systemd.git
synced 2025-03-23 10:50:16 +03:00
systemctl: when called as shutdown, fail if first argument isn't 'now'
This commit is contained in:
parent
e4a9373fb3
commit
442b90946a
@ -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,11 @@ static int shutdown_parse_argv(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > optind && !streq(argv[optind], "now")) {
|
||||
log_error("Expected 'now' argument.");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* We ignore the time argument */
|
||||
if (argc > optind + 1)
|
||||
arg_wall = argv + optind + 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user