diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-11-27 14:11:56 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-11-27 14:11:56 +0000 |
commit | 70035fe02be8053d048ae51d79eada21d3cffdc6 (patch) | |
tree | 589fcf3d0b8091f604d1ea2eb0e34ba33fa289f8 /src | |
parent | 3f4e0f9de28ae68548b661fbd32066b7b4b8dbb8 (diff) | |
download | skalibs-70035fe02be8053d048ae51d79eada21d3cffdc6.tar.xz |
Zero errno on EOF in allreadwrite()
Diffstat (limited to 'src')
-rw-r--r-- | src/libstddjb/allreadwrite.c | 6 |
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 ; |