Better logging for broken connections while streaming

This commit is contained in:
Ron Pedde 2006-10-09 00:16:48 +00:00
parent 2193e14c98
commit e0ff0c794e

View File

@ -250,12 +250,16 @@ int readwrite(int fromfd, int tofd) {
char buf[BLKSIZE]; char buf[BLKSIZE];
int bytesread; int bytesread;
if ((bytesread = r_read(fromfd, buf, BLKSIZE)) < 0) if ((bytesread = r_read(fromfd, buf, BLKSIZE)) < 0) {
DPRINTF(E_WARN,L_MISC,"Read error: %s\n",strerror(errno));
return -1; return -1;
}
if (bytesread == 0) if (bytesread == 0)
return 0; return 0;
if (r_write(tofd, buf, bytesread) < 0) if (r_write(tofd, buf, bytesread) < 0) {
DPRINTF(E_WARN,L_MISC,"Write error: %s\n",strerror(errno));
return -1; return -1;
}
return bytesread; return bytesread;
} }