Introduction
Introduction Statistics Contact Development Disclaimer Help
slock-failure-command-1.4.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
slock-failure-command-1.4.diff (1034B)
---
1 diff --git a/config.def.h b/config.def.h
2 index 9855e21..4c7b0d9 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -10,3 +10,10 @@ static const char *colorname[NUMCOLS] = {
6
7 /* treat a cleared input like a wrong password (color) */
8 static const int failonclear = 1;
9 +
10 +/* number of failed password attempts until failcommand is executed.
11 + Set to 0 to disable */
12 +static const int failcount = 0;
13 +
14 +/* command to be executed after [failcount] failed password attempts */
15 +static const char *failcommand = "shutdown";
16 diff --git a/slock.c b/slock.c
17 index d2f0886..53c567f 100644
18 --- a/slock.c
19 +++ b/slock.c
20 @@ -23,6 +23,7 @@
21 #include "util.h"
22
23 char *argv0;
24 +int failtrack = 0;
25
26 enum {
27 INIT,
28 @@ -167,6 +168,11 @@ readpw(Display *dpy, struct xrandr *rr, struct lock…
29 if (running) {
30 XBell(dpy, 100);
31 failure = 1;
32 + failtrack++;
33 +
34 + if (failtrack >= failcount && f…
35 + system(failcommand);
36 + }
37 }
38 explicit_bzero(&passwd, sizeof(passwd));
39 len = 0;
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.