From: Felix Fietkau Date: Thu, 3 Jan 2013 14:46:21 +0000 (+0100) Subject: ustream-fd: fix read error handling X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6c28da1ae203e181eec69c9ebe0c22cb1b0ff399;p=oweals%2Flibubox.git ustream-fd: fix read error handling Signed-off-by: Felix Fietkau --- 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);