mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Fix fallback on platforms that don't have sendfile()
It was quite badly broken.
This commit is contained in:
parent
2ca3cef4a3
commit
49fb5f3fbf
@ -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);
|
fprintf(stderr, "premature eof on fd %d\n", fd);
|
||||||
return -1;
|
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",
|
fprintf(stderr, "read %d bytes, expecting %u bytes on fd %d\n",
|
||||||
numread, amount, fd);
|
numread, amount, fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if ((size_t)numread != amount)
|
|
||||||
return -1;
|
|
||||||
else
|
else
|
||||||
return send(s, buf, amount, 0);
|
return send(s, buf, amount, 0);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user