--- parser3/src/main/pa_exec.C 2002/03/01 10:09:56 1.27 +++ parser3/src/main/pa_exec.C 2002/03/22 14:30:07 1.30 @@ -4,7 +4,7 @@ Copyright(c) 2000,2001, 2002 ArtLebedev Group(http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) - $Id: pa_exec.C,v 1.27 2002/03/01 10:09:56 paf Exp $ + $Id: pa_exec.C,v 1.30 2002/03/22 14:30:07 paf Exp $ @todo setrlimit @@ -76,7 +76,7 @@ static BOOL WINAPI CreateHiddenConsolePr NULL, NULL, TRUE, - 0, //todo CREATE_NO_WINDOW, + CREATE_NO_WINDOW, szEnv, NULL, &si, @@ -103,8 +103,7 @@ static void read_pipe(String& result, HA while(true) { char *buf=(char *)result.pool().malloc(MAX_STRING); unsigned long size; - ReadFile(hOutRead, buf, MAX_STRING, &size, NULL); - if(!size) + if(!ReadFile(hOutRead, buf, MAX_STRING, &size, NULL) || !size) break; result.APPEND_AS_IS(buf, size, file_spec, 0); } @@ -265,7 +264,7 @@ static void read_pipe(String& result, in while(true) { char *buf=(char *)result.pool().malloc(MAX_STRING); size_t size=read(file, buf, MAX_STRING); - if(!size) + if(!size) break; result.APPEND_AS_IS(buf, size, file_spec, 0); } @@ -273,6 +272,7 @@ static void read_pipe(String& result, in #endif +///@test maybe here and at argv construction --- cstr(String::UL_UNSPECIFIED static void append_env_pair(const Hash::Key& key, Hash::Val *value, void *info) { #ifdef WIN32 String& string=*static_cast(info); @@ -287,12 +287,25 @@ static void append_env_pair(const Hash:: **env_ref=string.cstr(); (*env_ref)++; #endif } +/** + @test thread safety: SetCurrentDirectory works per-process, not . + there's a field in createprocess, which is. + @test thread safety: on unix we sould change dir after fork! +*/ int pa_exec(const String& file_spec, const Hash *env, const Array *argv, const String& in, String& out, String& err) { Pool& pool=file_spec.pool(); +#ifdef NO_PA_EXECS + + throw Exception(0, 0, + &file_spec, + "parser execs are disabled [recompile parser without --disable-execs configure option]"); + +#else + #ifdef WIN32 char pwd[MAX_STRING]; @@ -403,6 +416,7 @@ from http://www.apache.org/websrc/cvsweb &file_spec, "pipe error"); #endif +#endif return 0; }