From a044698d93e88945bbf43c1dcb7e4332448f08a4 Mon Sep 17 00:00:00 2001 From: tjsaunders Date: Sat, 18 Oct 2014 22:22:03 -0700 Subject: [PATCH] Another place where we can check before calling close() on an fd. --- modules/mod_ctrls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/mod_ctrls.c b/modules/mod_ctrls.c index ceeb808e5d..bfaddf87aa 100644 --- a/modules/mod_ctrls.c +++ b/modules/mod_ctrls.c @@ -1217,8 +1217,10 @@ static void ctrls_restart_ev(const void *event_data, void *user_data) { pr_ctrls_cl_t *cl = NULL; for (cl = cl_list; cl; cl = cl->cl_next) { - close(cl->cl_fd); - cl->cl_fd = -1; + if (cl->cl_fd >= 0) { + (void) close(cl->cl_fd); + cl->cl_fd = -1; + } } }