--- parser3/src/main/pa_exec.C 2002/11/20 10:04:36 1.41 +++ parser3/src/main/pa_exec.C 2002/12/24 08:31:31 1.46 @@ -7,7 +7,7 @@ @todo setrlimit */ -static const char* IDENT_EXEC_C="$Date: 2002/11/20 10:04:36 $"; +static const char* IDENT_EXEC_C="$Date: 2002/12/24 08:31:31 $"; #include "pa_config_includes.h" @@ -163,10 +163,10 @@ static const char *buildCommand(Pool& po #else -static int execve_piped(const char *file_spec_cstr, +static pid_t execve_piped(const char *file_spec_cstr, char * const argv[], char * const env[], int *pipe_in, int *pipe_out, int *pipe_err) { - int pid; + pid_t pid; int in_fds[2]; int out_fds[2]; int err_fds[2]; @@ -211,7 +211,7 @@ static int execve_piped(const char *file close(err_fds[0]); close(err_fds[1]); } errno=save_errno; - return 0; + return -1; } if(!pid) { @@ -235,7 +235,8 @@ static int execve_piped(const char *file close(err_fds[1]); } - /* HP-UX SIGCHLD fix goes here, if someone will remind me what it is... */ + /* grabbed this from Apache source: */ + /* HP-UX SIGCHLD fix goes here, if someone will remind me what it is... */ signal(SIGCHLD, SIG_DFL); /* Was that it? */ // chdir to script's directory @@ -301,7 +302,7 @@ static void append_env_pair(const Hash:: string << key << "=" << *static_cast(value); char ***env_ref=static_cast(info); - **env_ref=string.cstr(String::UL_PASSAPPENED); (*env_ref)++; + **env_ref=string.cstr(String::UL_UNSPECIFIED); (*env_ref)++; #endif } @@ -330,7 +331,7 @@ int pa_exec( if(env) { String string(env->pool()); env->for_each(append_env_pair, &string); - env_cstr=string.cstr(); + env_cstr=string.cstr(String::UL_UNSPECIFIED); } if(DWORD error=CreateHiddenConsoleProcess(cmd, env_cstr, &pi, &hInWrite, &hOutRead, &hErrRead)) { char szErrorDesc[MAX_STRING]; @@ -412,14 +413,14 @@ from http://www.apache.org/websrc/cvsweb *env_ref=0; } - int pid=execve_piped( + pid_t pid=execve_piped( file_spec_cstr, argv_cstrs, env_cstrs, &pipe_write, &pipe_read, &pipe_err); - if(pid) { + if(pid>0) { // in child const char *in_cstr=in.cstr(); - if(*in) // there is some in data + if(*in_cstr) // there is some in data write(pipe_write, in_cstr, in.size()); close(pipe_write); read_pipe(out, pipe_read, file_spec_cstr, String::UL_AS_IS); @@ -431,7 +432,7 @@ from http://www.apache.org/websrc/cvsweb } else throw Exception(0, &file_spec, - "pipe error"); + "%s error: %s (%d)", pid<0?"fork":"pipe", strerror(errno), errno); #endif return 0;