--- parser3/src/targets/cgi/parser3.C 2020/12/31 19:48:47 1.342 +++ parser3/src/targets/cgi/parser3.C 2021/11/30 16:18:26 1.345 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.342 2020/12/31 19:48:47 moko Exp $"; +volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.345 2021/11/30 16:18:26 moko Exp $"; #include "pa_config_includes.h" @@ -77,7 +77,7 @@ static void pa_log(const char* fmt, va_l if(!opened && filespec_4log) { char beside_config_path[MAX_STRING]; - strncpy(beside_config_path, filespec_4log, MAX_STRING-1); beside_config_path[MAX_STRING-1]=0; + pa_strncpy(beside_config_path, filespec_4log, MAX_STRING); if(!(rsplit(beside_config_path, '/') || rsplit(beside_config_path, '\\'))) { // strip filename // no path, just filename strcpy(beside_config_path, "."); @@ -186,7 +186,7 @@ static void full_disk_path(const char* f || file_name[0] && file_name[1]==':' #endif ){ - strncpy(buf, file_name, buf_size-1); buf[buf_size-1]=0; + pa_strncpy(buf, file_name, buf_size); } else { char cwd[MAX_STRING]; snprintf(buf, buf_size, "%s/%s", getcwd(cwd, MAX_STRING) ? cwd : "", file_name); @@ -380,9 +380,6 @@ static void httpd_mode() { int sock = HTTPD_Server::bind(httpd_host_port); -#ifdef SIGCHLD - signal(SIGCHLD, SIG_IGN); -#endif #ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); #endif @@ -390,10 +387,12 @@ static void httpd_mode() { while(1){ #ifndef _MSC_VER pid_t pid=1; + if(HTTPD_Server::mode == HTTPD_Server::PARALLEL) + while (waitpid((pid_t)(-1), 0, WNOHANG) > 0); #endif try { HTTPD_Connection connection; - if(!connection.accept(sock, 5)) + if(!connection.accept(sock, 500)) continue; switch (HTTPD_Server::mode) {