Simplify signal handling a bit
This commit is contained in:
parent
450e8e6e6b
commit
3468a6e368
10
slstatus.c
10
slstatus.c
|
@ -837,11 +837,9 @@ wifi_essid(const char *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sighandler(const int signo)
|
terminate(const int signo)
|
||||||
{
|
{
|
||||||
if (signo == SIGTERM || signo == SIGINT) {
|
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -874,9 +872,9 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&act, 0, sizeof(act));
|
memset(&act, 0, sizeof(act));
|
||||||
act.sa_handler = sighandler;
|
act.sa_handler = terminate;
|
||||||
sigaction(SIGINT, &act, 0);
|
sigaction(SIGINT, &act, NULL);
|
||||||
sigaction(SIGTERM, &act, 0);
|
sigaction(SIGTERM, &act, NULL);
|
||||||
|
|
||||||
if (!sflag) {
|
if (!sflag) {
|
||||||
dpy = XOpenDisplay(NULL);
|
dpy = XOpenDisplay(NULL);
|
||||||
|
|
Loading…
Reference in New Issue