projects
/
project
/
libubox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ustream-fd: fix read error handling
[project/libubox.git]
/
ustream-fd.c
diff --git
a/ustream-fd.c
b/ustream-fd.c
index
93fd501
..
397ce5d
100644
(file)
--- a/
ustream-fd.c
+++ b/
ustream-fd.c
@@
-58,17
+58,19
@@
static void ustream_fd_read_pending(struct ustream_fd *sf, bool *more)
break;
len = read(sf->fd.fd, buf, buflen);
break;
len = read(sf->fd.fd, buf, buflen);
- if (!len) {
- sf->fd.eof = true;
- return;
- }
-
if (len < 0) {
if (errno == EINTR)
continue;
if (errno == EAGAIN)
return;
if (len < 0) {
if (errno == EINTR)
continue;
if (errno == EAGAIN)
return;
+
+ len = 0;
+ }
+
+ if (!len) {
+ sf->fd.eof = true;
+ return;
}
ustream_fill_read(s, len);
}
ustream_fill_read(s, len);