aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Branco <rbranco@suse.de>2026-06-27 10:04:48 +0000
committerWarner Losh <imp@FreeBSD.org>2026-07-08 05:16:01 +0000
commitf723b28c9663b70045e6db07f9fe72422a609c16 (patch)
treeae300e3c2c1319b5934738c064d511d6d3450ead
parentf5329a0d14712ae990f650286a6d5a04617c7cb3 (diff)
reboot: fix openlog(3) calls
LOG_CONS was OR'd into the facility argument instead of logopt, leaving logopt as 0. The correct call is openlog(ident, LOG_CONS, LOG_AUTH), as shutdown(8) and init(8) already do. PR: 296315 Signed-off-by: Ricardo Branco <rbranco@suse.de> Reviewed by: imp, des Pull Request: https://github.com/freebsd/freebsd-src/pull/2300
-rw-r--r--sbin/reboot/reboot.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index a11f92453147..047646d8089e 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -421,19 +421,19 @@ main(int argc, char *argv[])
user = (pw = getpwuid(getuid())) ?
pw->pw_name : "???";
if (dohalt) {
- openlog("halt", 0, LOG_AUTH | LOG_CONS);
+ openlog("halt", LOG_CONS, LOG_AUTH);
syslog(LOG_CRIT, "halted by %s", user);
} else if (howto & RB_REROOT) {
- openlog("reroot", 0, LOG_AUTH | LOG_CONS);
+ openlog("reroot", LOG_CONS, LOG_AUTH);
syslog(LOG_CRIT, "rerooted by %s", user);
} else if (howto & RB_POWEROFF) {
- openlog("reboot", 0, LOG_AUTH | LOG_CONS);
+ openlog("reboot", LOG_CONS, LOG_AUTH);
syslog(LOG_CRIT, "powered off by %s", user);
} else if (howto & RB_POWERCYCLE) {
- openlog("reboot", 0, LOG_AUTH | LOG_CONS);
+ openlog("reboot", LOG_CONS, LOG_AUTH);
syslog(LOG_CRIT, "power cycled by %s", user);
} else {
- openlog("reboot", 0, LOG_AUTH | LOG_CONS);
+ openlog("reboot", LOG_CONS, LOG_AUTH);
syslog(LOG_CRIT, "rebooted by %s", user);
}
}