diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2006-08-14 00:58:00 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2006-08-14 00:58:00 +0000 |
commit | 209df1f20e34620e6d970358b343af10e90800be (patch) | |
tree | 12b307f260701a7a715076980c79affc4d9b1e3a /driver.c | |
parent | d58961218666f5f0d4a6001729a6cc0bd2a77ec7 (diff) | |
download | fetchmail-209df1f20e34620e6d970358b343af10e90800be.tar.gz fetchmail-209df1f20e34620e6d970358b343af10e90800be.tar.bz2 fetchmail-209df1f20e34620e6d970358b343af10e90800be.zip |
Ignore SIGPIPE, EPIPE must suffice as error.
Calling longjmp() from a signal handler is unsafe.
svn path=/branches/BRANCH_6-3/; revision=4893
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 27 |
1 files changed, 5 insertions, 22 deletions
@@ -55,7 +55,6 @@ /* throw types for runtime errors */ #define THROW_TIMEOUT 1 /* server timed out */ -#define THROW_SIGPIPE 2 /* SIGPIPE on stream socket */ /* magic values for the message length array */ #define MSGLEN_UNKNOWN 0 /* length unknown (0 is impossible) */ @@ -110,18 +109,14 @@ static RETSIGTYPE timeout_handler (int signal) (void)signal; if(stage != STAGE_IDLE) { timeoutcount++; + /* XXX FIXME: this siglongjmp must die - it's not safe to be + * called from a function handler and breaks, for instance, + * getaddrinfo() */ siglongjmp(restart, THROW_TIMEOUT); } else idletimeout = 1; } -static RETSIGTYPE sigpipe_handler (int signal) -/* handle SIGPIPE signal indicating a broken stream socket */ -{ - (void)signal; - siglongjmp(restart, THROW_SIGPIPE); -} - #define CLEANUP_TIMEOUT 60 /* maximum timeout during cleanup */ static int cleanupSockClose (int fd) @@ -845,7 +840,6 @@ static int do_session( int tmperr; int deletions = 0, js; const char *msg; - SIGHANDLERTYPE pipesave; SIGHANDLERTYPE alrmsave; ctl->server.base_protocol = proto; @@ -859,9 +853,6 @@ static int do_session( alrmsave = set_signal_handler(SIGALRM, timeout_handler); mytimeout = ctl->server.timeout; - /* set up the broken-pipe timeout */ - pipesave = set_signal_handler(SIGPIPE, sigpipe_handler); - if ((js = sigsetjmp(restart,1))) { /* exception caught */ @@ -878,14 +869,7 @@ static int do_session( freeaddrinfo(ai1); ai1 = NULL; } - if (js == THROW_SIGPIPE) - { - set_signal_handler(SIGPIPE, SIG_IGN); - report(stdout, - GT_("SIGPIPE thrown from an MDA or a stream socket error\n")); - wait(0); - } - else if (js == THROW_TIMEOUT) + if (js == THROW_TIMEOUT) { if (phase == OPEN_WAIT) report(stdout, @@ -939,7 +923,7 @@ static int do_session( } else { - /* setjmp returned zero -> normal operation */ + /* sigsetjmp returned zero -> normal operation */ char buf[MSGBUFSIZE+1], *realhost; int count, newm, bytes; int fetches, dispatches, oldphase; @@ -1581,7 +1565,6 @@ closeUp: set_timeout(0); /* cancel any pending alarm */ set_signal_handler(SIGALRM, alrmsave); - set_signal_handler(SIGPIPE, pipesave); return(err); } |