You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2010/02/09 19:36:59 UTC
svn commit: r908151 - in /httpd/mod_fcgid/trunk/modules/fcgid: fcgid_proc.h
fcgid_proc_unix.c fcgid_proc_win.c
Author: trawick
Date: Tue Feb 9 18:36:57 2010
New Revision: 908151
URL: http://svn.apache.org/viewvc?rev=908151&view=rev
Log:
as of r905820, the first arg of proc_spawn_process() is
always the command to run (whether the requested script, a
wrapper around the script, or auth), so axe the unused
script-vs.-wrapper handling
Modified:
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc.h
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc.h?rev=908151&r1=908150&r2=908151&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc.h Tue Feb 9 18:36:57 2010
@@ -39,7 +39,7 @@
request_rec *request;
} fcgid_ipc;
-apr_status_t proc_spawn_process(char *lpszwapper,
+apr_status_t proc_spawn_process(const char *cmdline,
fcgid_proc_info * procinfo,
fcgid_procnode * procnode);
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c?rev=908151&r1=908150&r2=908151&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c Tue Feb 9 18:36:57 2010
@@ -168,7 +168,7 @@
return APR_SUCCESS;
}
-apr_status_t proc_spawn_process(char *lpszwapper, fcgid_proc_info *procinfo,
+apr_status_t proc_spawn_process(const char *cmdline, fcgid_proc_info *procinfo,
fcgid_procnode *procnode)
{
server_rec *main_server = procinfo->main_server;
@@ -185,11 +185,10 @@
const char *wargv[APACHE_ARG_MAX];
const char *word; /* For wrapper */
const char *tmp;
- const char *argv[2];
/* Build wrapper args */
argc = 0;
- tmp = lpszwapper;
+ tmp = cmdline;
while (1) {
word = ap_getword_white(procnode->proc_pool, &tmp);
if (word == NULL || *word == '\0')
@@ -213,8 +212,7 @@
getpid(), g_process_counter++);
apr_cpystrn(procnode->socket_path, unix_addr.sun_path,
sizeof(procnode->socket_path));
- apr_cpystrn(procnode->executable_path,
- (lpszwapper != NULL && lpszwapper[0] != '\0') ? wargv[0] : procinfo->cgipath,
+ apr_cpystrn(procnode->executable_path, wargv[0],
sizeof(procnode->executable_path));
/* Unlink the file just in case */
@@ -325,10 +323,7 @@
NULL)) != APR_SUCCESS
|| (rv = apr_procattr_dir_set(procattr,
ap_make_dirstr_parent(procnode->proc_pool,
- (lpszwapper != NULL
- && lpszwapper[0] !=
- '\0') ? wargv[0] :
- procinfo->cgipath))) != APR_SUCCESS
+ wargv[0]))) != APR_SUCCESS
|| (rv = apr_procattr_cmdtype_set(procattr, APR_PROGRAM)) != APR_SUCCESS
|| (rv = apr_os_file_put(&file, &unix_socket, 0,
procnode->proc_pool)) != APR_SUCCESS
@@ -345,47 +340,21 @@
* for it's a share memory address, both parent and child process may modify
* procnode->proc_id->pid, so sometimes it's 0 and sometimes it's >0
*/
- if (lpszwapper != NULL && lpszwapper[0] != '\0') {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, procinfo->main_server,
- "mod_fcgid: call %s with wrapper %s",
- procinfo->cgipath, lpszwapper);
- if ((rv = fcgid_create_privileged_process(&tmpproc,
- wargv[0], wargv,
- (const char *const *)
- proc_environ, procattr,
- procinfo,
- procnode->proc_pool)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rv, procinfo->main_server,
- "mod_fcgid: can't create wrapper process for %s",
- procinfo->cgipath);
- close(unix_socket);
- procnode->proc_id = tmpproc;
- return rv;
- }
- }
- else {
- argv[0] = procinfo->cgipath;
- argv[1] = NULL;
- if ((rv = fcgid_create_privileged_process(&tmpproc,
- procinfo->cgipath,
- argv,
- (const char *const *)
- proc_environ, procattr,
- procinfo,
- procnode->proc_pool)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rv, procinfo->main_server,
- "mod_fcgid: can't create process");
- close(unix_socket);
- procnode->proc_id = tmpproc;
- return rv;
- }
- }
+ rv = fcgid_create_privileged_process(&tmpproc, wargv[0], wargv,
+ (const char *const *)proc_environ,
+ procattr, procinfo,
+ procnode->proc_pool);
/* Close socket before try to connect to it */
close(unix_socket);
procnode->proc_id = tmpproc;
- return APR_SUCCESS;
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, procinfo->main_server,
+ "mod_fcgid: can't run %s", wargv[0]);
+ }
+
+ return rv;
}
apr_status_t proc_kill_gracefully(fcgid_procnode *procnode, server_rec *main_server)
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c?rev=908151&r1=908150&r2=908151&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c Tue Feb 9 18:36:57 2010
@@ -58,7 +58,7 @@
return APR_SUCCESS;
}
-apr_status_t proc_spawn_process(char *wrapper_cmdline, fcgid_proc_info *procinfo,
+apr_status_t proc_spawn_process(const char *cmdline, fcgid_proc_info *procinfo,
fcgid_procnode *procnode)
{
HANDLE *finish_event, listen_handle;
@@ -69,14 +69,13 @@
apr_file_t *file;
char **proc_environ;
char sock_path[_POSIX_PATH_MAX];
- char *argv[2];
int argc;
char *wargv[APACHE_ARG_MAX], *word; /* For wrapper */
const char *tmp;
/* Build wrapper args */
argc = 0;
- tmp = wrapper_cmdline;
+ tmp = cmdline;
while (1) {
word = ap_getword_white(procnode->proc_pool, &tmp);
if (word == NULL || *word == '\0')
@@ -132,8 +131,7 @@
return APR_ENOSOCKET;
}
apr_cpystrn(procnode->socket_path, sock_path, sizeof(procnode->socket_path));
- apr_cpystrn(procnode->executable_path,
- (wrapper_cmdline != NULL && wrapper_cmdline[0] != '\0') ? wargv[0] : procinfo->cgipath,
+ apr_cpystrn(procnode->executable_path, wargv[0],
sizeof(procnode->executable_path));
/* Build environment variables */
@@ -151,8 +149,7 @@
!= APR_SUCCESS
|| (rv = apr_procattr_dir_set(proc_attr,
ap_make_dirstr_parent(procnode->proc_pool,
- (wrapper_cmdline && wrapper_cmdline[0] != '\0')
- ? wargv[0] : procinfo->cgipath))) != APR_SUCCESS
+ wargv[0]))) != APR_SUCCESS
|| (rv = apr_procattr_cmdtype_set(proc_attr, APR_PROGRAM))
!= APR_SUCCESS
|| (rv = apr_procattr_detach_set(proc_attr, 1)) != APR_SUCCESS
@@ -170,37 +167,18 @@
}
/* fork and exec now */
- if (wrapper_cmdline != NULL && wrapper_cmdline[0] != '\0') {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, procinfo->main_server,
- "mod_fcgid: call %s with wrapper %s",
- procinfo->cgipath, wrapper_cmdline);
- if ((rv = apr_proc_create(&(procnode->proc_id), wargv[0],
- wargv, proc_environ, proc_attr,
- procnode->proc_pool)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rv, procinfo->main_server,
- "mod_fcgid: can't create wrapper process for %s",
- procinfo->cgipath);
- CloseHandle(listen_handle);
- return rv;
- }
- } else {
- argv[0] = procinfo->cgipath;
- argv[1] = NULL;
- if ((rv =
- apr_proc_create(&(procnode->proc_id), procinfo->cgipath,
- argv, proc_environ, proc_attr,
- procnode->proc_pool)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rv, procinfo->main_server,
- "mod_fcgid: can't create process");
- CloseHandle(listen_handle);
- return rv;
- }
- }
+ rv = apr_proc_create(&(procnode->proc_id), wargv[0], wargv,
+ proc_environ, proc_attr, procnode->proc_pool);
/* OK, I created the process, now put it back to idle list */
CloseHandle(listen_handle);
- return APR_SUCCESS;
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, procinfo->main_server,
+ "mod_fcgid: can't run %s", wargv[0]);
+ }
+
+ return rv;
}
apr_status_t proc_kill_gracefully(fcgid_procnode *procnode,