api: acknowledge reboot, halt, and poweroff

Finit carried out a reboot, halt, or poweroff requested over the
initctl socket, but replied with a NACK.  The command printed an
empty line and fell back to signalling PID 1.

The result was never set from the action taken.  Return what
shutdown_now() returns.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-17 11:00:49 +01:00
1 parent 20c422af69
commit 631baab756
2 files changed
+4 -1

No files matched your search

+3
View File
@@ -182,6 +182,9 @@ All relevant changes are documented in this file.
- Fix `initctl stop` of a forking service before it had written its PID
file. The PID file showing up later undid the stop and the service was
reported running. Now the late daemon is stopped instead
- Fix `reboot`, `halt`, and `poweroff` being refused by Finit over the
initctl socket, although carried out. The commands then also fell
back to signalling PID 1
- Fix a command whose name starts like a service option, e.g. `logger` or
`pidof`. It was taken as the `log` or `pid` option and the next argument
ran as the command, which also broke the `logger` example in finit.conf(5)
+1 -1
View File
@@ -244,7 +244,7 @@ static int do_reboot(int cmd, int timeout, char *buf, size_t len)
case INIT_CMD_REBOOT:
case INIT_CMD_HALT:
case INIT_CMD_POWEROFF:
shutdown_now(cmd, timeout);
rc = shutdown_now(cmd, timeout);
break;
case INIT_CMD_SUSPEND: