diff options
author | Quentin Rameau <quinq@fifth.space> | 2016-09-01 13:47:19 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-09-02 10:50:32 +0200 |
commit | 03a87179919eebab7d38c548e3ff8e2911512468 (patch) | |
tree | edd4ca9a742ca207d4c67b3d5d601df769e8fab8 | |
parent | 39fb855aa100c5a5a8b7f3b6cc1fbb2135fe7dde (diff) |
Localize running and failure inside readpw()
They are only needed there, so don't make them global.
-rw-r--r-- | slock.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -46,8 +46,6 @@ typedef struct { | |||
46 | 46 | ||
47 | static Lock **locks; | 47 | static Lock **locks; |
48 | static int nscreens; | 48 | static int nscreens; |
49 | static Bool running = True; | ||
50 | static Bool failure = False; | ||
51 | static Bool rr; | 49 | static Bool rr; |
52 | static int rrevbase; | 50 | static int rrevbase; |
53 | static int rrerrbase; | 51 | static int rrerrbase; |
@@ -132,14 +130,15 @@ readpw(Display *dpy, const char *pws) | |||
132 | #endif | 130 | #endif |
133 | { | 131 | { |
134 | char buf[32], passwd[256], *encrypted; | 132 | char buf[32], passwd[256], *encrypted; |
135 | int num, screen; | 133 | int num, screen, running, failure; |
136 | unsigned int len, color; | 134 | unsigned int len, color; |
137 | KeySym ksym; | 135 | KeySym ksym; |
138 | XEvent ev; | 136 | XEvent ev; |
139 | static int oldc = INIT; | 137 | static int oldc = INIT; |
140 | 138 | ||
141 | len = 0; | 139 | len = 0; |
142 | running = True; | 140 | running = 1; |
141 | failure = 0; | ||
143 | 142 | ||
144 | /* As "slock" stands for "Simple X display locker", the DPMS settings | 143 | /* As "slock" stands for "Simple X display locker", the DPMS settings |
145 | * had been removed and you can set it with "xset" or some other | 144 | * had been removed and you can set it with "xset" or some other |
@@ -253,7 +252,7 @@ lockscreen(Display *dpy, int screen) | |||
253 | XSetWindowAttributes wa; | 252 | XSetWindowAttributes wa; |
254 | Cursor invisible; | 253 | Cursor invisible; |
255 | 254 | ||
256 | if (!running || dpy == NULL || screen < 0 || !(lock = malloc(sizeof(Lock)))) | 255 | if (dpy == NULL || screen < 0 || !(lock = malloc(sizeof(Lock)))) |
257 | return NULL; | 256 | return NULL; |
258 | 257 | ||
259 | lock->screen = screen; | 258 | lock->screen = screen; |
@@ -376,7 +375,6 @@ main(int argc, char **argv) { | |||
376 | 375 | ||
377 | /* did we manage to lock everything? */ | 376 | /* did we manage to lock everything? */ |
378 | if (nlocks != nscreens) { | 377 | if (nlocks != nscreens) { |
379 | running = 0; | ||
380 | cleanup(dpy); | 378 | cleanup(dpy); |
381 | return 1; | 379 | return 1; |
382 | } | 380 | } |