Unlink socket when server is killed

This commit is contained in:
Marc André Tanner 2014-02-25 23:36:02 +01:00
parent fcaf5368fa
commit c14b9c9173
2 changed files with 5 additions and 0 deletions

View File

@ -251,6 +251,7 @@ static bool create_session(const char *name, char * const argv[]) {
break;
default:
/* SIGTTIN, SIGTTU */
sa.sa_handler = server_sigterm_handler;
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
sa.sa_handler = SIG_IGN;

View File

@ -126,6 +126,10 @@ static void server_pty_died_handler(int sig) {
errno = errsv;
}
static void server_sigterm_handler(int sig) {
exit(EXIT_FAILURE); /* invoke atexit handler */
}
static void server_atexit_handler() {
unlink(sockaddr.sun_path);
}