mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-15 07:15:03 -04:00
Treat a negative number of bytes to read as the kernel saying "I don't know."
svn:r1426
This commit is contained in:
parent
f65b8b0964
commit
3b461a6d03
@ -17,7 +17,7 @@ Changes in 2.0.3-alpha:
|
||||
o Support sendfile on Solaris: patch from Caitlin Mercer.
|
||||
o New functions to explicitly reference a socket used by an evhttp object. Patches from David Reiss.
|
||||
o When we send a BEV_EVENT_CONNECTED to indicate connected status, we no longer invoke the write callback as well unless we actually wrote data too.
|
||||
|
||||
o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
|
||||
|
||||
Changes in 2.0.2-alpha:
|
||||
o Add a new flag to bufferevents to make all callbacks automatically deferred.
|
||||
|
4
buffer.c
4
buffer.c
@ -1607,9 +1607,9 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
|
||||
|
||||
#if defined(FIONREAD)
|
||||
#ifdef WIN32
|
||||
if (ioctlsocket(fd, FIONREAD, &lng) == -1 || (n=lng) == 0) {
|
||||
if (ioctlsocket(fd, FIONREAD, &lng) == -1 || (n=lng) <= 0) {
|
||||
#else
|
||||
if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) {
|
||||
if (ioctl(fd, FIONREAD, &n) == -1 || n <= 0) {
|
||||
#endif
|
||||
n = EVBUFFER_MAX_READ;
|
||||
} else if (n > EVBUFFER_MAX_READ && n > howmuch) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user