Index | Thread | Search

From:
Ricardo Branco <rbranco@suse.de>
Subject:
[PATCH]: reboot(8): fix openlog() argument order
To:
tech@openbsd.org
Date:
Tue, 30 Jun 2026 14:59:21 +0200

Download raw body.

Thread
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.

Fix pending on FreeBSD: https://github.com/freebsd/freebsd-src/pull/2300
diff --git sbin/reboot/reboot.c sbin/reboot/reboot.c
index 0e215c2b93a..5e0c50df150 100644
--- sbin/reboot/reboot.c
+++ sbin/reboot/reboot.c
@@ -146,7 +146,7 @@ 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);
 			if (pflag) {
 				syslog(LOG_CRIT,
 					"halted (with powerdown) by %s", user);
@@ -154,7 +154,7 @@ main(int argc, char *argv[])
 				syslog(LOG_CRIT, "halted by %s", user);
 			}
 		} else {
-			openlog("reboot", 0, LOG_AUTH | LOG_CONS);
+			openlog("reboot", LOG_CONS, LOG_AUTH);
 			syslog(LOG_CRIT, "rebooted by %s", user);
 		}
 	}