httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject NT piped TransferLog bug (not logged, I will if you insist)
Date Thu, 03 Feb 2000 05:09:24 GMT
Question of coding practice after forcing rotatelogs.c to work on NT:

my fixup of http_log.c for both piped_log_child() and error_log_child():

#if defined(WIN32)
    char *shellcmd;
#elif defined(WIN32)
    shellcmd = getenv("COMSPEC");
    if (!shellcmd) return (-1);
    child_pid = spawnl(_P_NOWAIT, shellcmd, shellcmd, "/c", (char *)cmd,

was failing (in 1.3.11) with simply:
#elif defined(WIN32)
    child_pid = spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd,

samewise fixup is needed in piped_log_spawn(), etc (though not where we have
recoded with the CreateProcess fixup, wonder if 1/2 that issue wasn't the
lack of path info)...  this fixup looks ugly, but resolves CMD.EXE vs.
COMMAND.COM and other discrepancies in Win32.

There must be a 'more proper' way of maintaining the necessity of a dynamic
command shell value vs. the static Unix macro to "/bin/sh".

1) Would an ap_shell_path() to a char* be acceptable?  As far as I can tell,
SHELL_PATH is used infrequently so it might be overkill.

2) Is the getenv() acceptable for host environment access, or could you
point me at an internal cache of the environment that is more appropriate?

3) What about wrapping the entire junk in an ap_spawn_shell(arg0, [arg1,
[,...]] NULL) wrapper?

Oh, I came across this issue in rotatelogs.c as well; can we strike

#define MAX_PATH	1024

and replace with _MAX_PATH in the char buf2[MAX_PATH] declaration?
(Everyone has _MAX_PATH, right???  At least I tracked one down in msvc
stdlib.h, which is not so standard, I know <g>.  If not, some define in
ap_config.h et. al. would be good.)  The only other compiler warning came
from no return(0); close (not that it returns <g>).

I'm more than happy to submit a diff'd fixup, if someone would first comment
on my 3 Q's.  Any suggestions on a diff for WinNT?

View raw message