summaryrefslogtreecommitdiff
path: root/src/stdio/__stdio_read.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-02-24 10:51:16 -0500
committerRich Felker <dalias@aerifal.cx>2018-02-24 10:51:16 -0500
commitf92804188eb464536d638548e51e835b6c49e373 (patch)
treeb5f290463be7b7adbe63d1b2ed9544102591a1a7 /src/stdio/__stdio_read.c
parent9bf9c732f9d39d691e1f8841e7204c9c26321946 (diff)
downloadmusl-f92804188eb464536d638548e51e835b6c49e373.tar.gz
consistently return number of bytes read from stdio read backend
the stdio FILE read backend's return type is size_t, not ssize_t, and all of the special (non-fd-backed) FILE types already return the number of bytes read (zero) on error or eof. only __stdio_read leaked a syscall error return into its return value. fread had a workaround for this behavior going all the way back to the original check-in. remove the workaround since it's no longer needed.
Diffstat (limited to 'src/stdio/__stdio_read.c')
-rw-r--r--src/stdio/__stdio_read.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/__stdio_read.c b/src/stdio/__stdio_read.c
index af50508c..909c36a9 100644
--- a/src/stdio/__stdio_read.c
+++ b/src/stdio/__stdio_read.c
@@ -12,7 +12,7 @@ size_t __stdio_read(FILE *f, unsigned char *buf, size_t len)
cnt = syscall(SYS_readv, f->fd, iov, 2);
if (cnt <= 0) {
f->flags |= cnt ? F_ERR : F_EOF;
- return cnt;
+ return 0;
}
if (cnt <= iov[0].iov_len) return cnt;
cnt -= iov[0].iov_len;