From 70035fe02be8053d048ae51d79eada21d3cffdc6 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 27 Nov 2016 14:11:56 +0000 Subject: Zero errno on EOF in allreadwrite() --- src/libstddjb/allreadwrite.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libstddjb/allreadwrite.c b/src/libstddjb/allreadwrite.c index c15f6de..a811f69 100644 --- a/src/libstddjb/allreadwrite.c +++ b/src/libstddjb/allreadwrite.c @@ -9,7 +9,11 @@ unsigned int allreadwrite (iofunc_t_ref op, int fd, register char *buf, register while (len) { register int w = (*op)(fd, buf, len) ; - if (w <= 0) break ; + if (w <= 0) + { + if (!w) errno = 0 ; + break ; + } written += w ; buf += w ; len -= w ; -- cgit v1.2.3