diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/src/daemon.c | 5 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/src/daemon.c b/src/src/daemon.c index 35e61dbfd..bc33aec45 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -520,12 +520,13 @@ if (pid == 0) { if (smtp_out) { - int i; + int i, fd = fileno(smtp_in); uschar buf[128]; mac_smtp_fflush(); /* drain socket, for clean TCP FINs */ - for(i = 16; read(fileno(smtp_in), buf, sizeof(buf)) > 0 && i > 0; ) i--; + if (fcntl(fd, F_SETFL, O_NONBLOCK) == 0) + for(i = 16; read(fd, buf, sizeof(buf)) > 0 && i > 0; ) i--; } search_tidyup(); smtp_log_no_mail(); /* Log no mail if configured */ diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 6c6a10266..d6ef34eff 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -3168,8 +3168,9 @@ HDEBUG(D_transport|D_acl|D_v) debug_printf(" SMTP(close)>>\n"); if (lflags.send_quit) { shutdown(outblock.sock, SHUT_WR); - for (rc = 16; read(inblock.sock, inbuffer, sizeof(inbuffer)) > 0 && rc > 0;) - rc--; /* drain socket */ + if (fcntl(inblock.sock, F_SETFL, O_NONBLOCK) == 0) + for (rc = 16; read(inblock.sock, inbuffer, sizeof(inbuffer)) > 0 && rc > 0;) + rc--; /* drain socket */ } (void)close(inblock.sock); |