forked from github/abduco
Unlink socket when server is killed
This commit is contained in:
parent
fcaf5368fa
commit
c14b9c9173
1
abduco.c
1
abduco.c
|
|
@ -251,6 +251,7 @@ static bool create_session(const char *name, char * const argv[]) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* SIGTTIN, SIGTTU */
|
/* SIGTTIN, SIGTTU */
|
||||||
|
sa.sa_handler = server_sigterm_handler;
|
||||||
sigaction(SIGTERM, &sa, NULL);
|
sigaction(SIGTERM, &sa, NULL);
|
||||||
sigaction(SIGINT, &sa, NULL);
|
sigaction(SIGINT, &sa, NULL);
|
||||||
sa.sa_handler = SIG_IGN;
|
sa.sa_handler = SIG_IGN;
|
||||||
|
|
|
||||||
4
server.c
4
server.c
|
|
@ -126,6 +126,10 @@ static void server_pty_died_handler(int sig) {
|
||||||
errno = errsv;
|
errno = errsv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void server_sigterm_handler(int sig) {
|
||||||
|
exit(EXIT_FAILURE); /* invoke atexit handler */
|
||||||
|
}
|
||||||
|
|
||||||
static void server_atexit_handler() {
|
static void server_atexit_handler() {
|
||||||
unlink(sockaddr.sun_path);
|
unlink(sockaddr.sun_path);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue