diff options
-rw-r--r-- | daemon/logind/logind.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c index 68e6ba9e..b0b546be 100644 --- a/daemon/logind/logind.c +++ b/daemon/logind/logind.c @@ -1004,7 +1004,7 @@ auth_start(int fd, login_conn_ctx *conn) /////////////////////////////////////////////////////////////////////// // Event callbacks -static struct event ev_sighup, ev_tunnel; +static struct event ev_sighup, ev_pipe, ev_tunnel; static void sighup_cb(int signal, short event, void *arg) @@ -1016,6 +1016,12 @@ sighup_cb(int signal, short event, void *arg) } static void +sigpipe_cb(int signal, short event, void *arg) +{ + fprintf(stderr, LOG_PREFIX "caught sigpipe...\r\n"); +} + +static void endconn_cb(int fd, short event, void *arg) { login_conn_ctx *conn = (login_conn_ctx*) arg; @@ -1391,7 +1397,6 @@ main(int argc, char *argv[]) Signal(SIGPIPE, SIG_IGN); - stderr = stderr; while ( (ch = getopt(argc, argv, "f:p:t:l:hdDv")) != -1 ) { @@ -1512,6 +1517,8 @@ main(int argc, char *argv[]) // SIGHUP handler is reset in daemonize() signal_set(&ev_sighup, SIGHUP, sighup_cb, &ev_sighup); signal_add(&ev_sighup, NULL); + signal_set(&ev_sigpipe, SIGPIPE, sigpipe_cb, &ev_sigpipe); + signal_add(&ev_sigpipe, NULL); // spawn tunnel client if specified. if (*tclient_cmd) |