ustream-fd: fix read error handling

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
Felix Fietkau 2013-01-03 15:46:21 +01:00
parent e7825661a2
commit 6c28da1ae2

View file

@ -58,17 +58,19 @@ static void ustream_fd_read_pending(struct ustream_fd *sf, bool *more)
break; break;
len = read(sf->fd.fd, buf, buflen); len = read(sf->fd.fd, buf, buflen);
if (!len) {
sf->fd.eof = true;
return;
}
if (len < 0) { if (len < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
if (errno == EAGAIN) if (errno == EAGAIN)
return; return;
len = 0;
}
if (!len) {
sf->fd.eof = true;
return;
} }
ustream_fill_read(s, len); ustream_fill_read(s, len);