pcs 97/10/20 13:02:21
Modified: src/main alloc.c Log: Prevent unnecessary "premature end of headers" errors on Win32 by correctly spotting if a spawned CGI fails, and if so, using the normal Unix logging to note it. Specifically make the Win32 error return value from spawn*() of -1 onto the Unix error value of 0 within the Win32 code. Revision Changes Path 1.53 +4 -5 apachen/src/main/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apachen/src/main/alloc.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- alloc.c 1997/10/20 12:08:58 1.52 +++ alloc.c 1997/10/20 20:02:20 1.53 @@ -1301,8 +1301,9 @@ } pid = (*func) (data); - if (pid == -1) { - /* If we are going to save it, we ought to do something with it later, right? - Ben */ + if (pid == -1) pid = 0; // map Win32 error code onto Unix default + + if (!pid) { save_errno = errno; close(in_fds[1]); close(out_fds[0]); @@ -1317,9 +1318,7 @@ if (pipe_err) dup2(hStdErr, fileno(stderr)); - if(pid == -1) - aplog_error(APLOG_MARK, APLOG_ERR, NULL, "spawn failed"); - else { + if (pid) { note_subprocess(p, pid, kill_how); if (pipe_in) { *pipe_in = in_fds[1];