Fix fallback on platforms that don't have sendfile()

It was quite badly broken.
This commit is contained in:
Emil Mikulic 2006-07-21 07:11:08 +00:00
parent 2ca3cef4a3
commit 49fb5f3fbf

View File

@ -2057,14 +2057,17 @@ static ssize_t send_from_file(const int s, const int fd,
fprintf(stderr, "premature eof on fd %d\n", fd);
return -1;
}
else if (numread != -1)
else if (numread == -1)
{
fprintf(stderr, "error reading on fd %d: %s", fd, strerror(errno));
return -1;
}
else if ((size_t)numread != amount)
{
fprintf(stderr, "read %d bytes, expecting %u bytes on fd %d\n",
numread, amount, fd);
return -1;
}
else if ((size_t)numread != amount)
return -1;
else
return send(s, buf, amount, 0);
#endif