From 491c3559023033ad6d6e5fe220f23d2856f4d835 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 14 Jun 2009 01:36:23 +0000 Subject: * ignore sig_pipe: sometimes the tunnel mbbsd just die without reason...!? git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4604 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- daemon/logind/logind.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'daemon/logind') 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) @@ -1015,6 +1015,12 @@ sighup_cb(int signal, short event, void *arg) g_reload_data = 1; } +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) { @@ -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) -- cgit v1.2.3