projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b123f23
)
remove obfuscated flags bit-twiddling logic in __stdio_read
author
Rich Felker
<dalias@aerifal.cx>
Sat, 24 Feb 2018 15:43:13 +0000
(10:43 -0500)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 24 Feb 2018 15:43:13 +0000
(10:43 -0500)
replace with simple conditional that doesn't rely on assumption that
cnt is either 0 or -1.
src/stdio/__stdio_read.c
patch
|
blob
|
history
diff --git
a/src/stdio/__stdio_read.c
b/src/stdio/__stdio_read.c
index f8fa6d3bf381bd5356e0f3c7bac33286f828ea25..af50508c2e8a71df12f4428e4ec4f2bf65cae0b3 100644
(file)
--- 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;