diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-19 18:08:30 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-19 18:08:30 +0000 |
commit | 206b28ca15d11c0cb6f99553dbe8d891395e46e2 (patch) | |
tree | dc27793730c2c97ea75aed10d7e99cb4f19d9f96 /win32/win32.c | |
parent | 7ce9f9c25a3d2c95ffc4625ae168eaa00bc1ff95 (diff) |
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
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 15 |
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; |