Don't close 0-filedescriptors on session killing, its our indicator for not here...
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 10 May 2011 22:03:20 +0000 (22:03 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 10 May 2011 22:03:20 +0000 (22:03 +0000)
citadel/context.c

index dce6841c0aa450aaa15d0cf3249073b29e2ee8c6..e6547417a991c0d3d5ef6821e30617711516e12f 100644 (file)
@@ -350,9 +350,15 @@ void RemoveContext (CitContext *con)
 
        CtdlLogPrintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
 
-       /* If the client is still connected, blow 'em away. */
+       /* 
+        * If the client is still connected, blow 'em away. 
+        * if the socket is 0, its already gone or was never there.
+        */
        CtdlLogPrintf(CTDL_DEBUG, "Closing socket %d\n", con->client_socket);
-       close(con->client_socket);
+       if (con->client_socket != 0)
+       {
+               close(con->client_socket);
+       }
 
        /* If using AUTHMODE_LDAP, free the DN */
        if (con->ldap_dn) {