diff options
Diffstat (limited to 'w32/subproc')
-rw-r--r-- | w32/subproc/sub_proc.c | 3 | ||||
-rw-r--r-- | w32/subproc/w32err.c | 16 |
2 files changed, 11 insertions, 8 deletions
diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c index 52f2fa2..bf1e732 100644 --- a/w32/subproc/sub_proc.c +++ b/w32/subproc/sub_proc.c @@ -1193,6 +1193,9 @@ process_easy( if (process_begin(hProcess, argv, envp, argv[0], NULL)) { fake_exits_pending++; + /* process_begin() failed: make a note of that. */ + if (!((sub_process*) hProcess)->last_err) + ((sub_process*) hProcess)->last_err = -1; ((sub_process*) hProcess)->exit_code = process_last_err(hProcess); /* close up unused handles */ diff --git a/w32/subproc/w32err.c b/w32/subproc/w32err.c index afe7668..9bfa2c4 100644 --- a/w32/subproc/w32err.c +++ b/w32/subproc/w32err.c @@ -6,18 +6,18 @@ *
* Returns: a pointer to a static error
*
- * Notes/Dependencies: I got this from
+ * Notes/Dependencies: I got this from
* comp.os.ms-windows.programmer.win32
*/
-char *
+char *
map_windows32_error_to_string (DWORD ercode) {
/* __declspec (thread) necessary if you will use multiple threads */
__declspec (thread) static char szMessageBuffer[128];
-
- /* Fill message buffer with a default message in
- * case FormatMessage fails
+
+ /* Fill message buffer with a default message in
+ * case FormatMessage fails
*/
- wsprintf (szMessageBuffer, "Error %ld", ercode);
+ wsprintf (szMessageBuffer, "Error %ld\n", ercode);
/*
* Special code for winsock error handling.
@@ -33,7 +33,7 @@ __declspec (thread) static char szMessageBuffer[128]; sizeof(szMessageBuffer),
NULL);
FreeLibrary(hModule);
- }
+ }
} else {
/*
* Default system message handling
@@ -48,4 +48,4 @@ __declspec (thread) static char szMessageBuffer[128]; }
return szMessageBuffer;
}
-
+
|