From e1739269ff46796c3c6e3664ecbbb77f111694eb Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Tue, 15 Mar 2011 10:36:50 +0100 Subject: [PATCH] Make sure read_all sets errno to 0 at EOF. --- common/ioall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/ioall.c b/common/ioall.c index 1fca6f1..413477f 100644 --- a/common/ioall.c +++ b/common/ioall.c @@ -23,6 +23,7 @@ #include #include #include +#include int write_all(int fd, void *buf, int size) { @@ -47,6 +48,7 @@ int read_all(int fd, void *buf, int size) while (got_read < size) { ret = read(fd, (char *) buf + got_read, size - got_read); if (ret == 0) { + errno = 0; fprintf(stderr, "EOF\n"); return 0; }