summaryrefslogtreecommitdiff
path: root/slock.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2016-09-01 13:47:19 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-09-02 10:50:32 +0200
commit03a87179919eebab7d38c548e3ff8e2911512468 (patch)
treeedd4ca9a742ca207d4c67b3d5d601df769e8fab8 /slock.c
parent39fb855aa100c5a5a8b7f3b6cc1fbb2135fe7dde (diff)
Localize running and failure inside readpw()
They are only needed there, so don't make them global.
Diffstat (limited to 'slock.c')
-rw-r--r--slock.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/slock.c b/slock.c
index 0682279..83d426a 100644
--- a/slock.c
+++ b/slock.c
@@ -46,8 +46,6 @@ typedef struct {
static Lock **locks;
static int nscreens;
-static Bool running = True;
-static Bool failure = False;
static Bool rr;
static int rrevbase;
static int rrerrbase;
@@ -132,14 +130,15 @@ readpw(Display *dpy, const char *pws)
#endif
{
char buf[32], passwd[256], *encrypted;
- int num, screen;
+ int num, screen, running, failure;
unsigned int len, color;
KeySym ksym;
XEvent ev;
static int oldc = INIT;
len = 0;
- running = True;
+ running = 1;
+ failure = 0;
/* As "slock" stands for "Simple X display locker", the DPMS settings
* had been removed and you can set it with "xset" or some other
@@ -253,7 +252,7 @@ lockscreen(Display *dpy, int screen)
XSetWindowAttributes wa;
Cursor invisible;
- if (!running || dpy == NULL || screen < 0 || !(lock = malloc(sizeof(Lock))))
+ if (dpy == NULL || screen < 0 || !(lock = malloc(sizeof(Lock))))
return NULL;
lock->screen = screen;
@@ -376,7 +375,6 @@ main(int argc, char **argv) {
/* did we manage to lock everything? */
if (nlocks != nscreens) {
- running = 0;
cleanup(dpy);
return 1;
}