dovecot-2.2: net_transmit() may have wrongly returned EPIPE error.

dovecot at dovecot.org dovecot at dovecot.org
Thu Jan 30 23:04:46 EET 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/93cf0434dda4
changeset: 17120:93cf0434dda4
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jan 30 22:03:40 2014 +0100
description:
net_transmit() may have wrongly returned EPIPE error.
If errno was EPIPE before net_transmit() was called and sendto() didn't
change it, we still returned error.

Also removed the unlikely() call which isn't all that unlikely for
non-blocking code.

diffstat:

 src/lib/net.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (22 lines):

diff -r d9d2d04bb320 -r 93cf0434dda4 src/lib/net.c
--- a/src/lib/net.c	Thu Jan 30 03:38:57 2014 +0100
+++ b/src/lib/net.c	Thu Jan 30 22:03:40 2014 +0100
@@ -605,12 +605,12 @@
 	i_assert(len <= SSIZE_T_MAX);
 
 	ret = send(fd, data, len, 0);
-	if (unlikely(ret == -1 && (errno == EINTR || errno == EAGAIN)))
-		return 0;
-
-	if (unlikely(errno == EPIPE))
-		return -2;
-
+	if (ret == -1) {
+		if (errno == EINTR || errno == EAGAIN)
+			return 0;
+		if (errno == EPIPE)
+			return -2;
+	}
         return ret;
 }
 


More information about the dovecot-cvs mailing list