Check for invalid max socket fd before polling
This commit is contained in:
@@ -59,6 +59,10 @@ connection_new(unsigned int source_port, const char* source_ip, unsigned int des
|
|||||||
struct Connection*
|
struct Connection*
|
||||||
connection_poll_ready(struct Client* client) {
|
connection_poll_ready(struct Client* client) {
|
||||||
|
|
||||||
|
// Return a null connection if no sockets have been opened
|
||||||
|
if(max_fds < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
// Add all the connections' socket file descriptors to a watch list
|
// Add all the connections' socket file descriptors to a watch list
|
||||||
fd_set read_fds;
|
fd_set read_fds;
|
||||||
FD_ZERO(&read_fds);
|
FD_ZERO(&read_fds);
|
||||||
|
|||||||
Reference in New Issue
Block a user