mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 15:22:15 +00:00
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.
This commit is contained in:
parent
b123f23952
commit
9bf9c732f9
@ -11,7 +11,7 @@ size_t __stdio_read(FILE *f, unsigned char *buf, size_t len)
|
|||||||
|
|
||||||
cnt = syscall(SYS_readv, f->fd, iov, 2);
|
cnt = syscall(SYS_readv, f->fd, iov, 2);
|
||||||
if (cnt <= 0) {
|
if (cnt <= 0) {
|
||||||
f->flags |= F_EOF ^ ((F_ERR^F_EOF) & cnt);
|
f->flags |= cnt ? F_ERR : F_EOF;
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
if (cnt <= iov[0].iov_len) return cnt;
|
if (cnt <= iov[0].iov_len) return cnt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user