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. */ /* If an error occurred, return immediately. */
error_exit: error_exit:
err = GetLastError(); err = GetLastError();
if (err == ERROR_INVALID_PARAMETER) switch (err) {
case ERROR_INVALID_PARAMETER:
errno = ECHILD; errno = ECHILD;
else { break;
if (GetLastError() == ERROR_INVALID_HANDLE) case ERROR_INVALID_HANDLE:
errno = EINVAL; errno = EINVAL;
else break;
errno = map_errno(GetLastError()); default:
errno = map_errno(err);
break;
} }
CloseChildHandle(child); CloseChildHandle(child);
return -1; return -1;