ruby-changes:29398
From: nobu <ko1@a...>
Date: Thu, 20 Jun 2013 03:08:41 +0900 (JST)
Subject: [ruby-changes:29398] nobu:r41451 (trunk): win32.c: GetLastError once
nobu 2013-06-20 03:08:30 +0900 (Thu, 20 Jun 2013) New Revision: 41451 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41451 Log: win32.c: GetLastError once * win32/win32.c (poll_child_status): call GetLastError() once. Modified files: trunk/win32/win32.c Index: win32/win32.c =================================================================== --- win32/win32.c (revision 41450) +++ win32/win32.c (revision 41451) @@ -4033,13 +4033,16 @@ poll_child_status(struct ChildRecord *ch https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L4033 /* 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/