[PATCH]: reboot(8): fix openlog() argument order

Ricardo Branco <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
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
reboot.c.diff (text/x-patch, 703 B)
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);
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.