summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2019-07-22 08:06:52 +0000
committerkn <kn@openbsd.org>2019-07-22 08:06:52 +0000
commitd28e4965b9265f62b00cb8c6176118cdd2c9b640 (patch)
tree9265f3624df26509ec9bf51826369288d4926fb8
parentNo need to check first if something is not NULL to assign NULL to it. (diff)
downloadwireguard-openbsd-d28e4965b9265f62b00cb8c6176118cdd2c9b640.tar.xz
wireguard-openbsd-d28e4965b9265f62b00cb8c6176118cdd2c9b640.zip
Zap useless globals
Initialize stack variables directly instead of using global state in between. OK tedu deraadt
-rw-r--r--usr.sbin/apmd/apmd.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index ab1f2900908..b2911f43f3b 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.85 2019/06/28 13:32:46 deraadt Exp $ */
+/* $OpenBSD: apmd.c,v 1.86 2019/07/22 08:06:52 kn Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -57,9 +57,6 @@
#define AUTO_SUSPEND 1
#define AUTO_HIBERNATE 2
-const char apmdev[] = _PATH_APM_CTLDEV;
-const char sockfile[] = _PATH_APM_SOCKET;
-
int debug = 0;
int doperf = PERF_NONE;
@@ -375,7 +372,7 @@ resumed(int ctl_fd)
int
main(int argc, char *argv[])
{
- const char *fname = apmdev;
+ const char *fname = _PATH_APM_CTLDEV;
int ctl_fd, sock_fd, ch, suspends, standbys, hibernates, resumes;
int autoaction = 0;
int autolimit = 0;
@@ -385,7 +382,7 @@ main(int argc, char *argv[])
struct timespec ts = {TIMO, 0}, sts = {0, 0};
struct apm_power_info pinfo;
time_t apmtimeout = 0;
- const char *sockname = sockfile;
+ const char *sockname = _PATH_APM_SOCKET;
const char *errstr;
int kq, nchanges;
struct kevent ev[2];