From 06710ebd054f2658f2b46e7c784eea51d58bb72d Mon Sep 17 00:00:00 2001 From: Mark Caudill Date: Wed, 1 Apr 2020 11:45:00 -0400 Subject: Proposed fix for issue #5. Initialize all signals from RTMIN to RTMAX with a dummy handler before actually setting the "real" handlers. --- dwmblocks.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/dwmblocks.c b/dwmblocks.c index 88bdfb0..7d4616d 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -13,6 +13,7 @@ typedef struct { unsigned int interval; unsigned int signal; } Block; +void dummysighandler(int num); void sighandler(int num); void replace(char *str, char old, char new); void getcmds(int time); @@ -67,7 +68,7 @@ void getcmds(int time) { const Block* current; for(int i = 0; i < LENGTH(blocks); i++) - { + { current = blocks + i; if ((current->interval != 0 && time % current->interval == 0) || time == -1) getcmd(current,statusbar[i]); @@ -88,8 +89,12 @@ void getsigcmds(int signal) void setupsignals() { + /* initialize all real time signals with dummy handler */ + for(int i = SIGRTMIN; i <= SIGRTMAX; i++) + signal(i, dummysighandler); + for(int i = 0; i < LENGTH(blocks); i++) - { + { if (blocks[i].signal > 0) signal(SIGRTMIN+blocks[i].signal, sighandler); } @@ -146,6 +151,14 @@ void statusloop() } } +#ifndef __OpenBSD__ +/* this signal handler should do nothing */ +void dummysighandler(int signum) +{ + return; +} +#endif + #ifndef __OpenBSD__ void sighandler(int signum) { @@ -163,7 +176,7 @@ void termhandler(int signum) int main(int argc, char** argv) { for(int i = 0; i < argc; i++) - { + { if (!strcmp("-d",argv[i])) delim = argv[++i][0]; else if(!strcmp("-p",argv[i])) -- cgit v1.2.3 From dcb198d7d7da45b8d7cd2d241b42f8405bd049b1 Mon Sep 17 00:00:00 2001 From: Aidan Date: Mon, 6 Jul 2020 02:10:33 -0600 Subject: Added variable in makefile to change c compiler --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c45a563..3336e3c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PREFIX ?= /usr/local - +CC ?= cc output: dwmblocks.c blocks.h - cc `pkg-config --cflags x11` `pkg-config --libs x11` dwmblocks.c -o dwmblocks + ${CC} `pkg-config --cflags x11` `pkg-config --libs x11` dwmblocks.c -o dwmblocks clean: rm -f *.o *.gch dwmblocks install: output -- cgit v1.2.3