diff --git a/compat/mingw.c b/compat/mingw.c index 9b3a19875204f1..b7a61d3455c86d 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1662,12 +1662,12 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen si.StartupInfo.hStdError = winansi_get_osfhandle(fherr); /* The list of handles cannot contain duplicates */ - if ((intptr_t)si.StartupInfo.hStdInput >= 0) + if (si.StartupInfo.hStdInput != INVALID_HANDLE_VALUE) stdhandles[stdhandles_count++] = si.StartupInfo.hStdInput; - if ((intptr_t)si.StartupInfo.hStdOutput >= 0 && + if (si.StartupInfo.hStdOutput != INVALID_HANDLE_VALUE && si.StartupInfo.hStdOutput != si.StartupInfo.hStdInput) stdhandles[stdhandles_count++] = si.StartupInfo.hStdOutput; - if ((intptr_t)si.StartupInfo.hStdError >= 0 && + if (si.StartupInfo.hStdError != INVALID_HANDLE_VALUE && si.StartupInfo.hStdError != si.StartupInfo.hStdInput && si.StartupInfo.hStdError != si.StartupInfo.hStdOutput) stdhandles[stdhandles_count++] = si.StartupInfo.hStdError;