From abd867df209a33ad446fce2e233cda0d24b4ff53 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 24 May 2017 22:42:38 +0200 Subject: [PATCH] fixup! mingw: kill unterminated child processes on signals Let's be careful not to close a handle that has been closed already... Signed-off-by: Johannes Schindelin --- compat/mingw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index fe16bd1e87..1898a012e7 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1523,8 +1523,9 @@ static void kill_child_processes_on_signal(void) while (pinfo) { struct pinfo_t *info = pinfo; pinfo = pinfo->next; - exit_process(info->proc, status); - CloseHandle(info->proc); + if (exit_process(info->proc, status)) + /* the handle is still valid in case of error */ + CloseHandle(info->proc); free(info); }