diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-02-24 10:43:13 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-02-24 10:43:13 -0500 |
commit | 9bf9c732f9d39d691e1f8841e7204c9c26321946 (patch) | |
tree | 9f648f8553e26b6e6e4a928bd36d3add2c449964 /src/stdio/__stdio_read.c | |
parent | b123f2395266a44176e49cee251fb776e97f26e1 (diff) | |
download | musl-9bf9c732f9d39d691e1f8841e7204c9c26321946.tar.gz musl-9bf9c732f9d39d691e1f8841e7204c9c26321946.tar.bz2 musl-9bf9c732f9d39d691e1f8841e7204c9c26321946.tar.xz musl-9bf9c732f9d39d691e1f8841e7204c9c26321946.zip |
remove obfuscated flags bit-twiddling logic in __stdio_read
replace with simple conditional that doesn't rely on assumption that
cnt is either 0 or -1.
Diffstat (limited to 'src/stdio/__stdio_read.c')
-rw-r--r-- | src/stdio/__stdio_read.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/__stdio_read.c b/src/stdio/__stdio_read.c index f8fa6d3b..af50508c 100644 --- a/src/stdio/__stdio_read.c +++ b/src/stdio/__stdio_read.c @@ -11,7 +11,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 |= F_EOF ^ ((F_ERR^F_EOF) & cnt); + f->flags |= cnt ? F_ERR : F_EOF; return cnt; } if (cnt <= iov[0].iov_len) return cnt; |