summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 0290b89825..a6ce3120db 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4033,13 +4033,16 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
/* If an error occurred, return immediately. */
error_exit:
err = GetLastError();
- if (err == ERROR_INVALID_PARAMETER)
+ switch (err) {
+ case ERROR_INVALID_PARAMETER:
errno = ECHILD;
- else {
- if (GetLastError() == ERROR_INVALID_HANDLE)
- errno = EINVAL;
- else
- errno = map_errno(GetLastError());
+ break;
+ case ERROR_INVALID_HANDLE:
+ errno = EINVAL;
+ break;
+ default:
+ errno = map_errno(err);
+ break;
}
CloseChildHandle(child);
return -1;