X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/4548a3ecc4248a1d4bd4fdd45d9a2bb1e61d1e70..76ddfab4d76264b1cb30d7df642965c141e61545:/mts/smtp/smtp.c?ds=inline diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index 4b2e30a6..6fd178bc 100755 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -798,7 +798,19 @@ sm_end (int type) if (sm_mts == MTS_SMTP) smtalk (SM_QUIT, "QUIT"); else { + /* The SIGPIPE block replaces old calls to discard (). + We're not sure what the discard () calls were for, + maybe to prevent deadlock on old systems. In any + case, blocking SIGPIPE should be harmless. + Because the file handles are closed below, leave it + blocked. */ + sigset_t set, oset; + sigemptyset (&set); + sigaddset (&set, SIGPIPE); + sigprocmask (SIG_BLOCK, &set, &oset); + kill (sm_child, SIGKILL); + sm_child = NOTOK; } if (type == NOTOK) { sm_reply.code = sm_note.code; @@ -838,9 +850,11 @@ sm_end (int type) if (sasl_inbuffer) free(sasl_inbuffer); #endif /* CYRUS_SASL */ - } else { + } else if (sm_child != NOTOK) { status = pidwait (sm_child, OK); sm_child = NOTOK; + } else { + status = OK; } sm_rfp = sm_wfp = NULL;