From 817bc7979baab872631863d477f538a3eeba1aa7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 7 Dec 1998 02:54:02 +0000 Subject: Fix Ken Estes's core-dump bug. svn path=/trunk/; revision=2262 --- sink.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sink.c') diff --git a/sink.c b/sink.c index c603b8a6..3d012811 100644 --- a/sink.c +++ b/sink.c @@ -40,6 +40,9 @@ #define SIGCHLD SIGCLD #endif +/* makes the open_sink()/close_sink() pair non-reentrant */ +static lmtp_responses; + static int smtp_open(struct query *ctl) /* try to open a socket to the appropriate SMTP server for this query */ { @@ -714,7 +717,7 @@ int open_sink(struct query *ctl, struct msgblk *msg, * We need to stash this away in order to know how many * response lines to expect after the LMTP end-of-message. */ - msg->lmtp_responses = *good_addresses; + lmtp_responses = *good_addresses; return(PS_SUCCESS); } @@ -789,7 +792,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) * to people who got it the first time. */ if (ctl->listener == LMTP_MODE) - if (msg->lmtp_responses == 0) + if (lmtp_responses == 0) { SMTP_ok(ctl->smtp_socket); @@ -821,8 +824,8 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) char **responses; /* eat the RFC2033-required responses, saving errors */ - xalloca(responses, char **, sizeof(char *) * msg->lmtp_responses); - for (errors = i = 0; i < msg->lmtp_responses; i++) + xalloca(responses, char **, sizeof(char *) * lmtp_responses); + for (errors = i = 0; i < lmtp_responses; i++) { if (SMTP_ok(ctl->smtp_socket) == SM_OK) responses[i] = (char *)NULL; -- cgit v1.2.3