From e32de9626f1aaf6a564c93a139b43a1bad70fa2e Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 15 Feb 2024 14:28:54 -0700 Subject: 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(-) (limited to 'sbin/reboot') 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; -- cgit v1.2.3