Proposed fix for issue #5.

Initialize all signals from RTMIN to RTMAX with a dummy handler before
actually setting the "real" handlers.
This commit is contained in:
Mark Caudill 2020-04-01 11:45:00 -04:00
parent fefab14bee
commit 06710ebd05

View File

@ -13,6 +13,7 @@ typedef struct {
unsigned int interval; unsigned int interval;
unsigned int signal; unsigned int signal;
} Block; } Block;
void dummysighandler(int num);
void sighandler(int num); void sighandler(int num);
void replace(char *str, char old, char new); void replace(char *str, char old, char new);
void getcmds(int time); void getcmds(int time);
@ -88,6 +89,10 @@ void getsigcmds(int signal)
void setupsignals() 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++) for(int i = 0; i < LENGTH(blocks); i++)
{ {
if (blocks[i].signal > 0) if (blocks[i].signal > 0)
@ -146,6 +151,14 @@ void statusloop()
} }
} }
#ifndef __OpenBSD__
/* this signal handler should do nothing */
void dummysighandler(int signum)
{
return;
}
#endif
#ifndef __OpenBSD__ #ifndef __OpenBSD__
void sighandler(int signum) void sighandler(int signum)
{ {