From 7f39d05b67aec8b87fbad8d5b6381084f99120ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sat, 20 Dec 2025 00:26:23 +0100 Subject: [PATCH] reboot: Fix halt -p behavior The RB_HALT bit is always set when invoked as `halt`, so to maintain a distinction between `halt` and `halt -p`, we must check the RB_POWEROFF bit first. PR: 291814 Fixes: 4453ec5b8716 ("reboot: Default to a clean shutdown") Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54320 --- sbin/reboot/reboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index a147b7e08a95..002a393000eb 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -235,9 +235,9 @@ shutdown(int howto) { char sigstr[SIG2STR_MAX]; int signo = - howto & RB_HALT ? SIGUSR1 : - howto & RB_POWEROFF ? SIGUSR2 : howto & RB_POWERCYCLE ? SIGWINCH : + howto & RB_POWEROFF ? SIGUSR2 : + howto & RB_HALT ? SIGUSR1 : howto & RB_REROOT ? SIGEMT : SIGINT;