mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Fix signed-unsigned comparison.
This commit is contained in:
parent
5cf2862f08
commit
b50b4f1c5a
@ -2052,15 +2052,20 @@ static ssize_t send_from_file(const int s, const int fd,
|
|||||||
|
|
||||||
if (lseek(fd, ofs, SEEK_SET) == -1) err(1, "fseek(%d)", (int)ofs);
|
if (lseek(fd, ofs, SEEK_SET) == -1) err(1, "fseek(%d)", (int)ofs);
|
||||||
numread = read(fd, buf, amount);
|
numread = read(fd, buf, amount);
|
||||||
if (numread != amount)
|
|
||||||
{
|
|
||||||
if (numread == 0)
|
if (numread == 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "premature eof on fd %d\n", fd);
|
fprintf(stderr, "premature eof on fd %d\n", fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
else if (numread != -1)
|
else if (numread != -1)
|
||||||
|
{
|
||||||
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
|
||||||
return send(s, buf, amount, 0);
|
return send(s, buf, amount, 0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user