From 4bf6a4e2cdd88453a6a21225ee561ffc850d4359 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 10 May 2011 22:03:20 +0000 Subject: [PATCH] Don't close 0-filedescriptors on session killing, its our indicator for not here, since 0 equals STDIN which at best is redirected to /dev/null --- citadel/context.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/citadel/context.c b/citadel/context.c index dce6841c0..e6547417a 100644 --- a/citadel/context.c +++ b/citadel/context.c @@ -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) { -- 2.30.2