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:15:21 +0000 (22:15 +0000)
citadel/context.c

index e6707e679f2ab83185c83dad9158470690c4cd82..c2d739924fd40940d42928033f79bbdf02f618a8 100644 (file)
@@ -331,9 +331,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) {