diff --git a/upnphttp.c b/upnphttp.c index 974434e..90ecc7c 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -1289,6 +1289,10 @@ send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset) else if( errno != EAGAIN ) break; } + else if( ret == 0 ) + { + break; /* Premature end of file */ + } else { //DPRINTF(E_DEBUG, L_HTTP, "sent %lld bytes to %d. offset is now %lld.\n", ret, h->socket, offset); @@ -1309,6 +1313,10 @@ send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset) else break; } + else if( ret == 0 ) + { + break; /* premature end of file */ + } ret = write(h->ev.fd, buf, ret); if( ret == -1 ) { DPRINTF(E_DEBUG, L_HTTP, "write error :: error no. %d [%s]\n", errno, strerror(errno));