aboutsummaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 939f938fe2..146b2585ce 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1972,6 +1972,16 @@ int mingw_kill(pid_t pid, int sig)
CloseHandle(h);
return 0;
}
+ /*
+ * OpenProcess returns ERROR_INVALID_PARAMETER for
+ * non-existent PIDs. Map this to ESRCH for POSIX
+ * compatibility with kill(pid, 0).
+ */
+ if (GetLastError() == ERROR_INVALID_PARAMETER)
+ errno = ESRCH;
+ else
+ errno = err_win_to_posix(GetLastError());
+ return -1;
}
errno = EINVAL;