+1
Looks like an oversite that this patch wasn't applied long ago. The pattern of saving the errno of an earlier operation then restoring it on error exit is repeated all over alloc.c.
Bill
eff Trawick wrote:
When COMSPEC is unset or set to something bogus, trying to start Apache with a piped logger configured results in the messages
ap_spawn_child: Bad file descriptor Couldn't fork child for piped log process
The "Bad file descriptor" issue may indicate a problem in the cleanup logic, but it hides the original failure.
With the change below, the user sees
ap_spawn_child: No such file or directory
(More correct, probably not incredibly helpful.)
BTW, default shell command to use when COMSPEC isn't set is simply "CMD.EXE" but this is not helpful since PATH isn't being searched since Win32 piped log child code calls spawnl() instead of spawnlp() ;)
Index: src/main/alloc.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/alloc.c,v retrieving revision 1.149 diff -u -r1.149 alloc.c --- src/main/alloc.c 16 Feb 2004 22:29:32 -0000 1.149 +++ src/main/alloc.c 25 Jun 2004 11:59:24 -0000 @@ -2318,9 +2318,11 @@ (void) ap_release_mutex(spawn_mutex); /* * go on to the end of the function, where you can - * unblock alarms and return the pid + * return the pid */ - + if (!pid) { + errno = save_errno; + } } #elif defined(NETWARE) /* NetWare currently has no pipes yet. This will
