From 631baab7564059dffd59eec7206b4f2fe07238c7 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 17 Nov 2026 10:51:58 +0100 Subject: [PATCH] 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 --- doc/ChangeLog.md | 3 +++ src/api.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index d5e36e8a..3f975b99 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -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) diff --git a/src/api.c b/src/api.c index dd50a756..145eba38 100644 --- a/src/api.c +++ b/src/api.c @@ -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: