git: f723b28c9663 - main - reboot: fix openlog(3) calls

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 08 Jul 2026 05:17:01 UTC
The branch main has been updated by imp:

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

commit f723b28c9663b70045e6db07f9fe72422a609c16
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2026-06-27 10:04:48 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-07-08 05:16:01 +0000

    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
---
 sbin/reboot/reboot.c | 10 +++++-----
 1 file 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);
 		}
 	}