1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

win32.c: GetLastError once

* win32/win32.c (poll_child_status): call GetLastError() once.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-06-19 18:08:30 +00:00
parent 7ce9f9c25a
commit 206b28ca15

View file

@ -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;