]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix hang in safe_sendfile on SmartOS
authorSebastian Wiedenroth <sebastian.wiedenroth@skylime.net>
Thu, 16 Jul 2015 12:41:24 +0000 (14:41 +0200)
committerSebastian Wiedenroth <sebastian.wiedenroth@skylime.net>
Thu, 16 Jul 2015 12:41:24 +0000 (14:41 +0200)
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.

src/lib/sendfile-util.c

index 656a4d3cdf947d188560423cfbb2c1eeb721f7b6..6a944ce2559e694fbd9dfdf0464f5956e06c4e72 100644 (file)
@@ -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;