Skip to content
Permalink
Browse files

[fix] Fix signal handling

Do not reset signal handlers to `SIG_IGN` if they were set to it
previously.

Explicitly exit when a signal is received.
  • Loading branch information...
mmalecki committed Jul 3, 2013
1 parent 3a7fc2e commit fa40a2a3391cb96a7e37ffa6fc88ca311ed43ecd
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/aeternum.c
@@ -115,6 +115,7 @@ void handle_signal(int signal_status) {
if (opts.pidname) {
cleanup_pid_file(opts.pidname);
}
exit(0);
}

int stdio_redirect(char *dest, int fd) {
@@ -155,10 +156,9 @@ int main(int argc, char *argv[]) {
saneopt_t* opt;
char** args;

if (signal (SIGINT, handle_signal) == SIG_IGN)
signal (SIGINT, SIG_IGN);
if (signal (SIGHUP, handle_signal) == SIG_IGN)
signal (SIGHUP, SIG_IGN);
signal(SIGHUP, SIG_IGN);
signal(SIGINT, handle_signal);
signal(SIGTERM, handle_signal);

loop = uv_default_loop();

0 comments on commit fa40a2a

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.