repo: ngircd
action: commit
revision: 
path_from: 
revision_from: e9f3e69f36ca64f8945677bc72ccb7bbb57842e1:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit e9f3e69f36ca64f8945677bc72ccb7bbb57842e1
Author: Florian Westphal 
Date:   Sat Sep 24 02:20:00 2005 +0000

    use io_close instead of plain close in Conn_ExitListeners()

diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 57bfb16854d39b26aba0b00e9c8dda9567eaeafe..
index ..7be5d0a18e8026dd44375fe23644643df16f047f 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -17,7 +17,7 @@
 #include "portab.h"
 #include "io.h"

-static char UNUSED id[] = "$Id: conn.c,v 1.181 2005/09/12 19:10:20 fw Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.182 2005/09/24 02:20:00 fw Exp $";

 #include "imp.h"
 #include 
@@ -320,23 +320,22 @@ Conn_ExitListeners( void )
 {
 	/* Close down all listening sockets */
 	int *fd;
-	unsigned int arraylen;
+	size_t arraylen;
 #ifdef ZEROCONF
 	Rendezvous_UnregisterListeners( );
 #endif

 	arraylen = array_length(&My_Listeners, sizeof (int));
-	Log( LOG_INFO, "Shutting down all listening sockets (%d)...", arraylen );
+	Log( LOG_INFO, "Shutting down all listening sockets (%d total)...", arraylen );
+	fd = array_start(&My_Listeners);
 	while(arraylen--) {
-		fd = (int*) array_get(&My_Listeners, sizeof (int), arraylen);
-		if (fd) {
-			close(*fd);
+		assert(fd);
+		assert(*fd >= 0);
+		io_close(*fd);
 #ifdef DEBUG
-			Log( LOG_DEBUG, "Listening socket %d closed.", *fd );
-		} else {
-			Log( LOG_DEBUG, "array_get pos %d returned NULL", arraylen );
+		Log( LOG_DEBUG, "Listening socket %d closed.", *fd );
 #endif
-		}
+		fd++;
 	}
 	array_free(&My_Listeners);
 } /* Conn_ExitListeners */

-----END OF PAGE-----