ustream-fd: fix read error handling
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
parent
e7825661a2
commit
6c28da1ae2
1 changed files with 7 additions and 5 deletions
12
ustream-fd.c
12
ustream-fd.c
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue