Skip to content

Commit

Permalink
Handle SIGTERM the same as SIGINT
Browse files Browse the repository at this point in the history
  • Loading branch information
md5 authored and dormando committed Jan 1, 2015
1 parent a3fcd40 commit f87ac29
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -4941,7 +4941,7 @@ static void remove_pidfile(const char *pid_file) {
}

static void sig_handler(const int sig) {
printf("SIGINT handled.\n");
printf("Signal handled: %s.\n", strsignal(sig));
exit(EXIT_SUCCESS);
}

Expand Down Expand Up @@ -5077,8 +5077,9 @@ int main (int argc, char **argv) {
return EX_OSERR;
}

/* handle SIGINT */
/* handle SIGINT and SIGTERM */
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);

/* init settings */
settings_init();
Expand Down

0 comments on commit f87ac29

Please sign in to comment.