From: Bill Stoddard Date: Tue, 12 Oct 1999 14:45:57 +0000 (+0000) Subject: Fix bug interpreting cgi_child return code. Do some clean-up. X-Git-Tag: 1.3.10~273 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=312ea662f0609a3f0f9ec9d8635d30d5ced6b3e4;p=thirdparty%2Fapache%2Fhttpd.git Fix bug interpreting cgi_child return code. Do some clean-up. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83977 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index c28f310f40a..b4f7cc2bd46 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -295,7 +295,7 @@ struct cgi_child_stuff { char *argv0; }; -static int cgi_child(struct cgi_child_stuff *child_stuff, +static ap_status_t cgi_child(struct cgi_child_stuff *child_stuff, BUFF **script_out, BUFF **script_in, BUFF **script_err) { struct cgi_child_stuff *cld = child_stuff; @@ -308,7 +308,7 @@ static int cgi_child(struct cgi_child_stuff *child_stuff, ap_procattr_t *procattr; ap_proc_t *procnew; ap_os_proc_t fred; - int rc; + ap_status_t rc = APR_SUCCESS; #ifdef DEBUG_CGI #ifdef OS2 @@ -346,11 +346,6 @@ static int cgi_child(struct cgi_child_stuff *child_stuff, * NB only ISINDEX scripts get decoded arguments. */ -#ifdef TPF - ap_unblock_alarms(); - - return (0); -#else ap_cleanup_for_exec(); if ((ap_createprocattr_init(&procattr, child_context) != APR_SUCCESS) || @@ -363,9 +358,7 @@ static int cgi_child(struct cgi_child_stuff *child_stuff, /* Something bad happened, tell the world. */ ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "couldn't create child process: %s", r->filename); - ap_unblock_alarms(); - - return (-1); + rc = !APR_SUCCESS; } else { @@ -409,12 +402,9 @@ static int cgi_child(struct cgi_child_stuff *child_stuff, *script_err = ap_bcreate(child_context, B_RD); } } - - ap_unblock_alarms(); - - return (rc); } -#endif /* TPF */ + ap_unblock_alarms(); + return (rc); } static int cgi_handler(request_rec *r) @@ -500,7 +490,7 @@ static int cgi_handler(request_rec *r) * waiting for free_proc_chain to cleanup in the middle of an * SSI request -djg */ - if (cgi_child(&cld, &script_out, &script_in, &script_err) < 0) { + if (cgi_child(&cld, &script_out, &script_in, &script_err) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "couldn't spawn child process: %s", r->filename); return HTTP_INTERNAL_SERVER_ERROR;