Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-01-03 18:46:21 +0400
committerFelix Fietkau <nbd@openwrt.org>2013-01-03 19:32:40 +0400
commit6c28da1ae203e181eec69c9ebe0c22cb1b0ff399 (patch)
tree974f87b0af00dbab37dd8baa61b6a17e8513c0c2 /ustream-fd.c
parente7825661a2a5239c05bf0e250cd0d9c1eed6419d (diff)
ustream-fd: fix read error handling
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'ustream-fd.c')
-rw-r--r--ustream-fd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ustream-fd.c b/ustream-fd.c
index 93fd501..397ce5d 100644
--- 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);
- if (!len) {
- sf->fd.eof = true;
- 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);