From c318d60646c0929b55b68fb73a1abb5002275f30 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 18 Jun 2008 09:10:04 +0000 Subject: * win32/win32.c (poll_child_status): set EINVAL to errno when GetExitCodeProcess() fails with ERROR_INVALID_HANDLE. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index b62adad77..813c4ee19 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2007,9 +2007,9 @@ is_pipe(SOCKET sock) /* DONT call this for SOCKET! it clains it is PIPE. */ { int ret; - RUBY_CRITICAL( - ret = (GetFileType((HANDLE)sock) == FILE_TYPE_PIPE) - ); + RUBY_CRITICAL({ + ret = (GetFileType((HANDLE)sock) == FILE_TYPE_PIPE); + }); return ret; } @@ -2857,8 +2857,12 @@ poll_child_status(struct ChildRecord *child, int *stat_loc) err = GetLastError(); if (err == ERROR_INVALID_PARAMETER) errno = ECHILD; - else - errno = map_errno(GetLastError()); + else { + if (GetLastError() == ERROR_INVALID_HANDLE) + errno = EINVAL; + else + errno = map_errno(GetLastError()); + } CloseChildHandle(child); return -1; } -- cgit