http: fix error handling in the fallback read/write path

This commit is contained in:
Justin Maggard 2014-04-18 15:46:00 -07:00
parent e2cebb68e1
commit 08c21f39d1

View File

@ -1289,13 +1289,17 @@ send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset)
ret = read(sendfd, buf, send_size);
if( ret == -1 ) {
DPRINTF(E_DEBUG, L_HTTP, "read error :: error no. %d [%s]\n", errno, strerror(errno));
if( errno != EAGAIN )
if( errno == EAGAIN )
continue;
else
break;
}
ret = write(h->socket, buf, ret);
if( ret == -1 ) {
DPRINTF(E_DEBUG, L_HTTP, "write error :: error no. %d [%s]\n", errno, strerror(errno));
if( errno != EAGAIN )
if( errno == EAGAIN )
continue;
else
break;
}
offset += ret;