summaryrefslogtreecommitdiff
path: root/common/tio.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/tio.c')
-rw-r--r--common/tio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/tio.c b/common/tio.c
index 3b81a55..f28ac91 100644
--- a/common/tio.c
+++ b/common/tio.c
@@ -277,8 +277,8 @@ int tio_read(TFILE *fp, void *buf, size_t count)
}
else if ((rv < 0) && (errno != EINTR) && (errno != EAGAIN))
return -1; /* something went wrong with the read */
- /* skip the read part in the buffer */
- fp->readbuffer.len = rv;
+ else if (rv > 0)
+ fp->readbuffer.len = rv; /* skip the read part in the buffer */
#ifdef DEBUG_TIO_STATS
fp->bytesread += rv;
#endif /* DEBUG_TIO_STATS */