From bf4ae09b22a3afab77a1bf9113ff5a12a93cbe03 Mon Sep 17 00:00:00 2001 From: hniksic Date: Thu, 25 Mar 2004 11:18:54 -0800 Subject: [PATCH] [svn] Fix fake_fork error handling for Windows 98. Patch by David Fritz. --- src/ChangeLog | 6 ++++++ src/mswindows.c | 14 +++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b422b45e..9b90176c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2004-03-25 David Fritz + + * mswindows.c (fake_fork_child): Ignore error code when + OpenFileMapping() fails; assume it failed because the object does + not exist. + 2004-03-24 David Fritz * mswindows.c (fake_fork): New function. diff --git a/src/mswindows.c b/src/mswindows.c index e2be4dd5..df8d5161 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -158,19 +158,15 @@ fake_fork_child (void) HANDLE section, event; struct fake_fork_info *info; char *name; - DWORD le; name = make_section_name (GetCurrentProcessId ()); section = OpenFileMapping (FILE_MAP_WRITE, FALSE, name); - le = GetLastError (); xfree (name); + /* It seems that Windows 9x and NT set last-error inconsistently when + OpenFileMapping() fails; so we assume it failed because the section + object does not exist. */ if (!section) - { - if (le == ERROR_FILE_NOT_FOUND) - return 0; /* Section object does not exist; we are the parent. */ - else - return -1; - } + return 0; /* We are the parent. */ info = MapViewOfFile (section, FILE_MAP_WRITE, 0, 0, 0); if (!info) @@ -258,7 +254,7 @@ fake_fork (void) if (!event) return; - /* Creat the child process detached form the current console and in a + /* Create the child process detached form the current console and in a suspended state. */ memset (&si, 0, sizeof (si)); si.cb = sizeof (si); -- 2.39.2