Initialize stack variables directly instead of using global state in
between.

OK?

Index: apmd.c
===================================================================
RCS file: /cvs/src/usr.sbin/apmd/apmd.c,v
retrieving revision 1.85
diff -u -p -r1.85 apmd.c
--- apmd.c      28 Jun 2019 13:32:46 -0000      1.85
+++ apmd.c      21 Jul 2019 23:05:40 -0000
@@ -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];

Reply via email to