From fc9758da8e841366355d6396559cb2e2fc4aa247 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 26 Feb 2015 16:39:30 +0100 Subject: [PATCH] Fix Coverity CID #87811 Double close Fix double close of TCP socket introduced in GIT ded4b39, replaced with closing all open stdio descriptors, which shouldn't really be needed. Signed-off-by: Joachim Nilsson --- svc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/svc.c b/svc.c index d157ed57..e615b464 100644 --- a/svc.c +++ b/svc.c @@ -677,8 +677,11 @@ int svc_start(svc_t *svc) status = execv(svc->cmd, args); /* XXX: Maybe use execve() to be able to launch scripts? */ if (SVC_CMD_INETD == svc->type) { - if (svc->inetd.type == SOCK_STREAM) - close(sd); + if (svc->inetd.type == SOCK_STREAM) { + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + } } exit(status);