summaryrefslogtreecommitdiffstats
path: root/sbin/reboot/reboot.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2005-01-25 08:14:00 +0000
committerdelphij <delphij@FreeBSD.org>2005-01-25 08:14:00 +0000
commit106964bd37d13acd9ec149548ca1b47752575415 (patch)
treea539c64ebbe4d18fdd9a6888c5935fc659802fe9 /sbin/reboot/reboot.c
parent3a20b645939ab4351f59612bc36aeb274a0a7ac8 (diff)
downloadFreeBSD-src-106964bd37d13acd9ec149548ca1b47752575415.zip
FreeBSD-src-106964bd37d13acd9ec149548ca1b47752575415.tar.gz
The kernel specified in main() of reboot(8) will be initialized
with -k option and never be used without kflag. This confuses gcc because we set "kflag" at the same time with "kernel", but the logic is not that apparant for gcc. Since we can initialize "kernel" to NULL then know if "k" option is set through determining whether it is still NULL, don't try to have gcc to guess why we are connecting "kflag" with "kernel" and use "kernel" directly in place of kflag. Bump WARNS?= from 2 to 6
Diffstat (limited to 'sbin/reboot/reboot.c')
-rw-r--r--sbin/reboot/reboot.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 9bc866a..0be2300 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -65,9 +65,9 @@ int
main(int argc, char *argv[])
{
struct passwd *pw;
- int ch, howto, i, fd, kflag, lflag, nflag, qflag, pflag, sverrno;
+ int ch, howto, i, fd, lflag, nflag, qflag, pflag, sverrno;
u_int pageins;
- char *kernel, *p;
+ char *kernel = NULL, *p;
const char *user;
if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) {
@@ -75,14 +75,13 @@ main(int argc, char *argv[])
howto = RB_HALT;
} else
howto = 0;
- kflag = lflag = nflag = qflag = 0;
+ lflag = nflag = qflag = 0;
while ((ch = getopt(argc, argv, "dk:lnpq")) != -1)
switch(ch) {
case 'd':
howto |= RB_DUMP;
break;
case 'k':
- kflag = 1;
kernel = optarg;
break;
case 'l':
@@ -118,7 +117,7 @@ main(int argc, char *argv[])
err(1, NULL);
}
- if (kflag) {
+ if (kernel != NULL) {
fd = open("/boot/nextboot.conf", O_WRONLY | O_CREAT, 0444);
if (fd > -1) {
(void)write(fd, "nextboot_enable=\"YES\"\n", 22);
OpenPOWER on IntegriCloud