diff options
author | ed <ed@FreeBSD.org> | 2011-12-11 11:42:44 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2011-12-11 11:42:44 +0000 |
commit | f30d5ac5ec19b2cac4518ac4a2059470f6813e06 (patch) | |
tree | 37d49919618c46e945ccaef49f27253af7b9ee98 /sbin/reboot | |
parent | 38db8319a95f2326f4158e57e8d099da65372eca (diff) | |
download | FreeBSD-src-f30d5ac5ec19b2cac4518ac4a2059470f6813e06.zip FreeBSD-src-f30d5ac5ec19b2cac4518ac4a2059470f6813e06.tar.gz |
Let reboot(8) use getprogname() to compare the program name.
While there, mark the global variable dohalt static, as reboot(8) only
consists of a single C file.
Diffstat (limited to 'sbin/reboot')
-rw-r--r-- | sbin/reboot/reboot.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index 9e5dab8..d927db0 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); static void usage(void); static u_int get_pageins(void); -int dohalt; +static int dohalt; int main(int argc, char *argv[]) @@ -69,9 +69,9 @@ main(int argc, char *argv[]) const struct passwd *pw; int ch, howto, i, fd, lflag, nflag, qflag, sverrno; u_int pageins; - const char *p, *user, *kernel = NULL; + const char *user, *kernel = NULL; - if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) { + if (strcmp(getprogname(), "halt") == 0) { dohalt = 1; howto = RB_HALT; } else |