You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1998/06/29 14:33:12 UTC

[PATCH] ap_spawn_child() under Win32 & mod_rewrite

PR#2483 reports that RewriteMap program still don't work under Win32 because
of a SIGSEGV. The reporter is right, ap_spawn_child_core() calls the child
function with NULL while in the child function the file handles have to be
available. I've assembled the above patch from the reporters description/patch
for testing by our Win32 folks. (I cannot test it myself).

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Index: CHANGES
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/CHANGES,v
retrieving revision 1.939
diff -u -r1.939 CHANGES
--- CHANGES	1998/06/29 12:21:01	1.939
+++ CHANGES	1998/06/29 12:30:03
@@ -1,5 +1,9 @@
 Changes with Apache 1.3.1
 
+  *) Fix ap_spawn_child() by providing a child_info structure.
+     This fixed at least the RewriteMap programs under Win32.
+     [Marco De Michele <md...@tin.it>] PR#2483
+
   *) PORT: Add UnixWare 7 support
      [Vadim Kostoglodoff <va...@olly.ru>] PR#2463
 
Index: main/alloc.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/main/alloc.c,v
retrieving revision 1.96
diff -u -r1.96 alloc.c
--- alloc.c	1998/06/13 15:22:52	1.96
+++ alloc.c	1998/06/29 12:28:42
@@ -1850,6 +1850,7 @@
 	HANDLE thread_handle;
 	int hStdIn, hStdOut, hStdErr;
 	int old_priority;
+	child_info info;
 
 	(void) ap_acquire_mutex(spawn_mutex);
 	thread_handle = GetCurrentThread();	/* doesn't need to be closed */
@@ -1876,7 +1877,11 @@
 	    close(err_fds[1]);
 	}
 
-	pid = (*func) (data, NULL);
+	info.hPipeInputRead =   GetStdHandle(STD_INPUT_HANDLE);
+	info.hPipeOutputWrite = GetStdHandle(STD_OUTPUT_HANDLE);
+	info.hPipeErrorWrite  = GetStdHandle(STD_ERROR_HANDLE);
+
+	pid = (*func) (data, &info);
         if (pid == -1) pid = 0;   /* map Win32 error code onto Unix default */
 
         if (!pid) {