From 86f4c06bee47fc73e5d6181db97611a6afca2b61 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 7 Mar 2018 15:24:47 +0100 Subject: [PATCH] fixup! mingw: spawned processes need to inherit only standard handles Let's preserve the correct errno (thanks, t0061!) Signed-off-by: Johannes Schindelin --- compat/mingw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 93f30782c7..38b62bdbbe 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1793,13 +1793,13 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL, NULL, TRUE, flags, wenvblk, dir ? wdir : NULL, &si.StartupInfo, &pi); - if (ret) + if (ret) { + errno = err_win_to_posix(GetLastError()); warning("failed to restrict file handles (%ld)\n\n%s", err, buf.buf); + } strbuf_release(&buf); - } - - if (!ret) + } else if (!ret) errno = err_win_to_posix(GetLastError()); if (si.lpAttributeList)