reboot: Fix halt -p behavior
Some checks are pending
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run

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:		4453ec5b87 ("reboot: Default to a clean shutdown")
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D54320
This commit is contained in:
Dag-Erling Smørgrav 2025-12-20 00:26:23 +01:00
parent a8c594d277
commit 7f39d05b67

View file

@ -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;