From: Sebastian Wiedenroth Date: Thu, 16 Jul 2015 12:41:24 +0000 (+0200) Subject: lib: Fix hang in safe_sendfile on SmartOS X-Git-Tag: 2.2.19.rc1~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=158e0bc894a55722e337d1ebdffc90fd9d6d2b7f;p=thirdparty%2Fdovecot%2Fcore.git lib: 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 --git a/src/lib/sendfile-util.c b/src/lib/sendfile-util.c index 656a4d3cdf..6a944ce255 100644 --- a/src/lib/sendfile-util.c +++ b/src/lib/sendfile-util.c @@ -116,7 +116,7 @@ ssize_t safe_sendfile(int out_fd, int in_fd, uoff_t *offset, size_t count) 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;