From 6264d2e15692cfc6dfcd1a437e38ab6004acf0bc Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 1 Sep 2004 09:47:31 +0000 Subject: [PATCH] [project @ 2004-09-01 09:47:31 by simonmar] Win32 rawSystem: set errno to EINVAL on error. This is a gross hack, but is slightly better than the existing situation (errno not set at all, caller tries to report errno and draws a blank). Microsoft's C runtime has a conversion function from Win32 error codes into errno error codes, but it isn't part of the external interface. grrrrr. Strictly speaking, we should have support for Win32 error codes in the base package. --- cbits/rawSystem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cbits/rawSystem.c b/cbits/rawSystem.c index 0a31546..0aac633 100644 --- a/cbits/rawSystem.c +++ b/cbits/rawSystem.c @@ -76,10 +76,14 @@ rawSystem(HsAddr cmd) Since we are going to wait for the process to terminate anyway, there is no problem with such sharing. */ + errno = EINVAL; // ToDo: wrong, caller should use GetLastError() return -1; } WaitForSingleObject(pInfo.hProcess, INFINITE); - if (GetExitCodeProcess(pInfo.hProcess, &retCode) == 0) return -1; + if (GetExitCodeProcess(pInfo.hProcess, &retCode) == 0) { + errno = EINVAL; // ToDo: wrong, caller should use GetLastError() + return -1; + } CloseHandle(pInfo.hProcess); CloseHandle(pInfo.hThread); -- 1.7.10.4