summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstddjb/allreadwrite.c6
1 files changed, 5 insertions, 1 deletions
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 ;