# HG changeset patch
# User Sebastian Wiedenroth <sebastian.wiedenr...@skylime.net>
# Date 1437050484 -7200
#      Thu Jul 16 14:41:24 2015 +0200
# Node ID 7ef3a533b097e8e6590e754dc56ad308ab29233b
# Parent  e3640ccaa76d77a9658126d1f8f306480dad8af7
Fix hang in safe_sendfile on SmartOS

The call to sendfile on SmartOS can fail with EOPNOTSUPP. This is a valid error
code and documented in the man page. This error code needs to be handled or
else dovecot will retry the sendfile call endlessly and hang.

diff -r e3640ccaa76d -r 7ef3a533b097 src/lib/sendfile-util.c
--- a/src/lib/sendfile-util.c   Sat Jan 10 04:32:42 2015 +0200
+++ b/src/lib/sendfile-util.c   Thu Jul 16 14:41:24 2015 +0200
@@ -116,7 +116,7 @@
                if (errno == EINVAL) {
                        /* most likely trying to read past EOF */
                        ret = 0;
-               } else if (errno == EAFNOSUPPORT) {
+               } else if (errno == EAFNOSUPPORT || errno == EOPNOTSUPP) {
                        /* not supported, return Linux-like EINVAL so caller
                           sees only consistent errnos. */
                        errno = EINVAL;

Reply via email to