Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
Re: [PATCH]: reboot(8): fix openlog() argument order
To:
Ricardo Branco <rbranco@suse.de>
Cc:
tech@openbsd.org
Date:
Wed, 1 Jul 2026 10:45:10 +1000

Download raw body.

Thread
On Tue, Jun 30, 2026 at 02:59:21PM +0200, Ricardo Branco wrote:
> 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.

thanks, committed

> 
> 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);
>  		}
>  	}