diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-06-15 13:25:25 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-06-15 13:25:25 +0000 |
commit | c1b67fa602da7d75c5699f5ded875b8f77a1b913 (patch) | |
tree | c658d0949c4c53e0e946b1f691fb4ff3a95d2c65 /klogd.c | |
parent | 1a2af0bd5df4b57359041076244b867a15e23a8c (diff) | |
download | rsyslog-c1b67fa602da7d75c5699f5ded875b8f77a1b913.tar.gz rsyslog-c1b67fa602da7d75c5699f5ded875b8f77a1b913.tar.xz rsyslog-c1b67fa602da7d75c5699f5ded875b8f77a1b913.zip |
brought signal handling again to a usable state; klogd now again terminates
if it is told to do so ;)
Diffstat (limited to 'klogd.c')
-rw-r--r-- | klogd.c | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -458,6 +458,7 @@ void stop_logging(int sig) void stop_daemon(int sig) { change_state = 1; + terminate = 1; return; } @@ -937,11 +938,12 @@ static void LogProcLine(void) int main(int argc, char *argv[]) { - auto int ch, - use_output = 0; + int ch, + use_output = 0; - auto char *log_level = (char *) 0, - *output = (char *) 0; + char *log_level = (char *) 0, + *output = (char *) 0; + struct sigaction sigAct; #ifndef TESTING chdir ("/"); @@ -1064,12 +1066,18 @@ int main(int argc, char *argv[]) #endif /* Signal setups. */ + // TODO: change this all to sigaction for (ch= 1; ch < NSIG; ++ch) - signal(ch, SIG_IGN); - signal(SIGINT, stop_daemon); - signal(SIGKILL, stop_daemon); - signal(SIGTERM, stop_daemon); - signal(SIGHUP, stop_daemon); + signal(ch, SIG_IGN); + + sigAct.sa_handler = stop_daemon; + sigemptyset(&sigAct.sa_mask); + sigAct.sa_flags = 0; + sigaction(SIGINT, &sigAct, NULL); + sigaction(SIGKILL, &sigAct, NULL); + sigaction(SIGTERM, &sigAct, NULL); + sigaction(SIGHUP, &sigAct, NULL); + signal(SIGTSTP, stop_logging); signal(SIGCONT, restart); signal(SIGUSR1, reload_daemon); |