X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/1b7185f555d06faa9831c3b2345ddd9e88f03edf..aec8bcc80d152089426e63cacf455cd456787036:/uslip/uslip.c diff --git a/uslip/uslip.c b/uslip/uslip.c index 853df5b2..0ed9e70e 100644 --- a/uslip/uslip.c +++ b/uslip/uslip.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -570,11 +571,15 @@ static void do_slip_in(int fd, unsigned mode, void *hunoz) } } +static void slip_term(int n, void *fdp) + { close_slip(*(int *)fdp); } + static void slipif(void) { int fd; dstr d = DSTR_INIT; struct sockaddr_un sun; + sig term; size_t sz; /* --- Make the socket --- */ @@ -599,6 +604,10 @@ static void slipif(void) dribble_out = make_dribbler(STDOUT_FILENO, done_slip_dribble, 0); sel_addfile(&slip_in); + sig_init(&sel); + sig_add(&term, SIGTERM, slip_term, &fd); + sig_add(&term, SIGINT, slip_term, &fd); + initqueue(&q_in); reasons++;