src - FreeBSD source tree

1 min read Original article ↗
authorDag-Erling Smørgrav <des@FreeBSD.org>2025-12-19 23:26:23 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2025-12-19 23:26:37 +0000
commit7f39d05b67aec8b87fbad8d5b6381084f99120ec (patch)
tree25e90bec5b50442c7fb97c1c4eddbe7131241870
parenta8c594d27779b95f33c856521ec1039fa552d869 (diff)

reboot: Fix halt -p behaviorHEADmain

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

-rw-r--r--sbin/reboot/reboot.c4

1 files 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;