From cce071aafca38789ec53c09e5bab179d51df6ef1 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 11 Mar 2020 01:51:06 +0000 Subject: [PATCH] Move lprintf() out of fork() child... it uses a mutex and the state of mutexes are undefined in children. --- src/sbbs3/websrvr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c index 798a253d3c..749d908029 100644 --- a/src/sbbs3/websrvr.c +++ b/src/sbbs3/websrvr.c @@ -4708,6 +4708,7 @@ static BOOL exec_cgi(http_session_t *session) char cgipath[MAX_PATH+1]; char *p; BOOL orig_keep=FALSE; + char *handler; SAFECOPY(cmdline,session->req.physical_path); @@ -4728,19 +4729,18 @@ static BOOL exec_cgi(http_session_t *session) return(FALSE); } + handler = get_cgi_handler(cmdline); + if (handler) + lprintf(LOG_INFO,"%04d Using handler %s to execute %s",session->socket,handler,cmdline); + if((child=fork())==0) { str_list_t env_list; - char *handler; /* Do a full suid thing. */ if(startup->setuid!=NULL) startup->setuid(TRUE); env_list=get_cgi_env(session); - handler = get_cgi_handler(cmdline); - if (handler) - lprintf(LOG_INFO,"%04d Using handler %s to execute %s",session->socket,handler,cmdline); - /* Set up STDIO */ dup2(session->socket,0); /* redirect stdin */ close(out_pipe[0]); /* close read-end of pipe */ -- GitLab