diff --git a/CHANGES b/CHANGES index af7f033bb..10372382f 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ Bugfixes: - Util: Fix overflow when loading invalid UPS patches - Tools: Fix recurring multiple times over the same library - GBA I/O: Handle audio registers specially when deserializing + - Util: Fix highest-fd socket not being returned by SocketAccept Misc: - SDL: Remove scancode key input - GBA Video: Clean up unused timers diff --git a/include/mgba-util/socket.h b/include/mgba-util/socket.h index 327c2c69c..ad00696c0 100644 --- a/include/mgba-util/socket.h +++ b/include/mgba-util/socket.h @@ -293,10 +293,11 @@ static inline int SocketPoll(size_t nSockets, Socket* reads, Socket* writes, Soc errors[i] = INVALID_SOCKET; } } + ++maxFd; struct timeval tv; tv.tv_sec = timeoutMillis / 1000; tv.tv_usec = (timeoutMillis % 1000) * 1000; - int result = select(maxFd + 1, &rset, &wset, &eset, timeoutMillis < 0 ? 0 : &tv); + int result = select(maxFd, &rset, &wset, &eset, timeoutMillis < 0 ? 0 : &tv); int r = 0; int w = 0; int e = 0;