[project @ 2004-09-01 09:47:31 by simonmar]
authorsimonmar <unknown>
Wed, 1 Sep 2004 09:47:31 +0000 (09:47 +0000)
committersimonmar <unknown>
Wed, 1 Sep 2004 09:47:31 +0000 (09:47 +0000)
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

index 0a31546..0aac633 100644 (file)
@@ -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);