git: e32de9626f1a - main - reboot: initialize howto

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 15 Feb 2024 21:32:54 UTC
The branch main has been updated by imp:

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

commit e32de9626f1aaf6a564c93a139b43a1bad70fa2e
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-15 21:28:54 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-15 21:32:04 +0000

    reboot: initialize howto
    
    Make static analyzers happy by initialzing howto to 0. Coverity is
    cranky that it could be used unused. But it's analysis is incomplete
    because the args to getopt when it wasn't initialized preclude it from
    being used.
---
 sbin/reboot/reboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index a31c31892745..e9d6487da6a5 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -175,7 +175,7 @@ main(int argc, char *argv[])
 {
 	struct utmpx utx;
 	const struct passwd *pw;
-	int ch, howto, i, sverrno;
+	int ch, howto = 0, i, sverrno;
 	bool Dflag, fflag, lflag, Nflag, nflag, qflag;
 	uint64_t pageins;
 	const char *user, *kernel = NULL, *getopts = GETOPT_REBOOT;
@@ -188,6 +188,7 @@ main(int argc, char *argv[])
 		donextboot = true;
 		getopts = GETOPT_NEXTBOOT; /* Note: reboot's extra opts return '?' */
 	} else {
+		/* reboot */
 		howto = 0;
 	}
 	Dflag = fflag = lflag = Nflag = nflag = qflag = false;