changeset 19980:ae42c253887b

istream-unix: Fixed handling of EOF from fd_read() (ret==0). This situation was ignored.
author Stephan Bosch <stephan@rename-it.nl>
date Sun, 03 Apr 2016 22:54:17 +0200
parents f16790b6e558
children ec835c27c248
files src/lib/istream-unix.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream-unix.c	Thu Mar 31 16:35:06 2016 +0300
+++ b/src/lib/istream-unix.c	Sun Apr 03 22:54:17 2016 +0200
@@ -44,6 +44,13 @@
 	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);