From 44704ef233f5f4d65c9f37deb01c077a82aaccb5 Mon Sep 17 00:00:00 2001 From: hniksic Date: Sun, 9 May 2004 14:50:00 -0700 Subject: [PATCH] [svn] Fix fake_fork under Borland C. Submitted by David Fritz. --- src/ChangeLog | 5 +++++ src/mswindows.c | 22 +++------------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c62b5126..b260efa4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-05-09 David Fritz + + * mswindows.c (fake_fork): Pass entire command line to the child + process. + 2004-03-31 Hrvoje Niksic * http.c (gethttp): Fix typo: SCHEME_SSL -> SCHEME_HTTPS. diff --git a/src/mswindows.c b/src/mswindows.c index df8d5161..4a9afeef 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -209,7 +209,6 @@ fake_fork_child (void) static void fake_fork (void) { - char *cmdline, *args; char exe[MAX_PATH + 1]; DWORD exe_len, le; SECURITY_ATTRIBUTES sa; @@ -222,22 +221,6 @@ fake_fork (void) event = section = pi.hProcess = pi.hThread = NULL; - /* Get command line arguments to pass to the child process. - We need to skip the name of the command (what amounts to argv[0]). */ - cmdline = GetCommandLine (); - if (*cmdline == '"') - { - args = strchr (cmdline + 1, '"'); - if (args) - ++args; - } - else - args = strchr (cmdline, ' '); - - /* It's ok if args is NULL, that would mean there were no arguments - after the command name. As it is now though, we would never get here - if that were true. */ - /* Get the fully qualified name of our executable. This is more reliable than using argv[0]. */ exe_len = GetModuleFileName (GetModuleHandle (NULL), exe, sizeof (exe)); @@ -258,8 +241,9 @@ fake_fork (void) suspended state. */ memset (&si, 0, sizeof (si)); si.cb = sizeof (si); - rv = CreateProcess (exe, args, NULL, NULL, TRUE, CREATE_SUSPENDED | - DETACHED_PROCESS, NULL, NULL, &si, &pi); + rv = CreateProcess (exe, GetCommandLine (), NULL, NULL, TRUE, + CREATE_SUSPENDED | DETACHED_PROCESS, + NULL, NULL, &si, &pi); if (!rv) goto cleanup;