diff options
Diffstat (limited to 'src/common/socket.c')
-rw-r--r-- | src/common/socket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 262351dcf..81ea19468 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -938,7 +938,7 @@ static int connect_check_(uint32 ip) /// Timer function. /// Deletes old connection history records. -static int connect_check_clear(int tid, unsigned int tick, int id, intptr data) +static int connect_check_clear(int tid, unsigned int tick, int id, intptr_t data) { int i; int clear = 0; @@ -1118,6 +1118,9 @@ void socket_final(void) /// Closes a socket. void do_close(int fd) { + if( fd <= 0 ||fd >= FD_SETSIZE ) + return;// invalid + flush_fifo(fd); // Try to send what's left (although it might not succeed since it's a nonblocking socket) sFD_CLR(fd, &readfds);// this needs to be done before closing the socket sShutdown(fd, SHUT_RDWR); // Disallow further reads/writes |