commit 70035fe02be8053d048ae51d79eada21d3cffdc6
parent 3f4e0f9de28ae68548b661fbd32066b7b4b8dbb8
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Sun, 27 Nov 2016 14:11:56 +0000
Zero errno on EOF in allreadwrite()
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git 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 ;