]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
istream-unix: Fixed handling of EOF from fd_read() (ret==0).
authorStephan Bosch <stephan@rename-it.nl>
Sun, 3 Apr 2016 20:54:17 +0000 (22:54 +0200)
committerStephan Bosch <stephan@rename-it.nl>
Sun, 3 Apr 2016 20:54:17 +0000 (22:54 +0200)
This situation was ignored.

src/lib/istream-unix.c

index fb6e8e1ac7d6aa3cda21fbb490251896ab261261..f4465a9d3709e57fbf86dd1f61e3a6fcf1b049ab 100644 (file)
@@ -44,6 +44,13 @@ static ssize_t i_stream_unix_read(struct istream_private *stream)
        if (ustream->read_fd != -1)
                ustream->next_read_fd = FALSE;
 
+       if (ret == 0) {
+               /* EOF */
+               stream->istream.eof = TRUE;
+               ustream->fstream.seen_eof = TRUE;
+               return -1;
+       }
+
        if (unlikely(ret < 0)) {
                if (errno == EINTR || errno == EAGAIN) {
                        i_assert(!stream->istream.blocking);