X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fngircd%2Fsighandlers.c;h=a219105f4b5aff571e045f22d58f0f5fc4d17162;hb=e3e181f4b3eae0e552632bce19bdff990196938f;hp=aaff1eabfa2099488ffca7f648fe2eec50a60d33;hpb=b3cfbc3d28de9098be7cffc22ea9c5b98c36443f;p=ngircd-alex.git diff --git a/src/ngircd/sighandlers.c b/src/ngircd/sighandlers.c index aaff1eab..a219105f 100644 --- a/src/ngircd/sighandlers.c +++ b/src/ngircd/sighandlers.c @@ -218,8 +218,11 @@ Signal_Handler_BH(int Signal) break; #ifdef DEBUG case SIGUSR2: - if (NGIRCd_Debug) + if (NGIRCd_Debug) { + Log(LOG_INFO|LOG_snotice, + "Got SIGUSR2, dumping internal state ..."); Dump_State(); + } break; default: Log(LOG_DEBUG, "Got signal %d! Ignored.", Signal); @@ -236,7 +239,7 @@ Signal_Callback(int fd, short UNUSED what) (void) what; do { - ret = read(fd, &sig, sizeof(sig)); + ret = (int)read(fd, &sig, sizeof(sig)); if (ret == sizeof(int)) Signal_Handler_BH(sig); } while (ret == sizeof(int)); @@ -266,6 +269,8 @@ Signals_Init(void) #ifdef HAVE_SIGACTION struct sigaction saction; #endif + if (signalpipe[0] > 0 || signalpipe[1] > 0) + return true; if (pipe(signalpipe)) return false; @@ -324,11 +329,12 @@ Signals_Exit(void) sigaction(SIGPIPE, &saction, NULL); #else for (i=0; i < C_ARRAY_SIZE(signals_catch) ; i++) - sigaction(signals_catch[i], &saction, NULL); + signal(signals_catch[i], SIG_DFL); signal(SIGPIPE, SIG_DFL); #endif close(signalpipe[1]); close(signalpipe[0]); + signalpipe[0] = signalpipe[1] = 0; } /* -eof- */