From 9ef634559f3cde232586b1dc6fd00bea3f3d8e53 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Sun, 10 Jul 2011 06:17:06 +0000 Subject: * Merged changes from trunk [14827:14894/trunk]. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14895 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/socket.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/common/socket.c') 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 -- cgit v1.2.3-70-g09d2