瀏覽代碼

Fixed a small mistake in r11503 causing a fatal error&exit on unix when you try to do a graceful exit (by ctrl+c for example)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11538 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage 17 年之前
父節點
當前提交
33decb0759
共有 2 個文件被更改,包括 6 次插入4 次删除
  1. 2 0
      Changelog-Trunk.txt
  2. 4 4
      src/common/socket.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/10/21
+	* Fixed a small mistake in r11503 causing a fatal error&exit on unix
+	  when you try to do a graceful exit (by ctrl+c for example) [ultramage]
 	* Removed SC_INCAGIRATE/SC_INCDEXRATE as they are not used anymore.
 	* Added SC_INCASPDRATE, SC_INCFLEE2, SC_INCCRI, SC_INCDEF, SC_INCBASEATK
 	  and SC_FASTCAST as these are required by the newer items. [Skotlex]

+ 4 - 4
src/common/socket.c

@@ -551,14 +551,14 @@ int do_sockets(int next)
 	memcpy(&rfd, &readfds, sizeof(rfd));
 	ret = select(fd_max, &rfd, NULL, NULL, &timeout);
 
-	if( ret < 0 )
+	if( ret == SOCKET_ERROR )
 	{
-		if( ret != S_EINTR )
+		if( s_errno != S_EINTR )
 		{
-			ShowFatalError("do_sockets: select() returned %d!\n", ret);
+			ShowFatalError("do_sockets: select() failed, error code %d!\n", s_errno);
 			exit(EXIT_FAILURE);
 		}
-		return 0;
+		return 0; // interrupted by a signal, just loop and try again
 	}
 
 #ifdef WIN32