git: 7f39d05b67ae - main - reboot: Fix halt -p behavior

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Fri, 19 Dec 2025 23:27:13 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=7f39d05b67aec8b87fbad8d5b6381084f99120ec

commit 7f39d05b67aec8b87fbad8d5b6381084f99120ec
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-12-19 23:26:23 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-12-19 23:26:37 +0000

    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;