]> granicus.if.org Git - apache/commitdiff
fixes some compilation errors (macros, function params, etc). also shifts
authorGreg Stein <gstein@apache.org>
Sat, 27 May 2000 00:48:49 +0000 (00:48 +0000)
committerGreg Stein <gstein@apache.org>
Sat, 27 May 2000 00:48:49 +0000 (00:48 +0000)
    the time when ap_destroy_pool() is called. it used to be called too
    soon, which caused a core dump on the second CGI request.

Submitted by: Paul J. Reder <rederpj@raleigh.ibm.com>
Reviewed by: Greg Stein

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85308 13f79535-47bb-0310-9956-ffa450edef68

modules/generators/mod_cgid.c

index 1db51715bfe4cb467cbbe18bf0f4c6bb7cf94fb1..e8f932745be09a43c988a0497963ffbc1af59793 100644 (file)
@@ -127,6 +127,8 @@ static int is_scriptaliased(request_rec *r)
 #define DEFAULT_BUFBYTES 1024 
 #define DEFAULT_SOCKET "logs/cgisock"
 
+#define SHELL_PATH "/bin/sh"
+
 typedef struct { 
     const char *sockname;
     char *logname; 
@@ -302,14 +304,16 @@ static void cgid_maint(int reason, void *data, ap_wait_t status)
 #ifdef APR_HAS_OTHER_CHILD
     int *sd = data;
     switch (reason) {
-        case OC_REASON_DEATH:
-        case OC_REASON_LOST:
+        case APR_OC_REASON_DEATH:
+        case APR_OC_REASON_LOST:
             /* stop gap to make sure everything else works.  In the end,
-             * we'll just restart the cgid server. */   
+             * we'll just restart the cgid server. */
+            ap_destroy_pool(pcgi);
             kill(getppid(), SIGWINCH);
             break;
-        case OC_REASON_RESTART:
-        case OC_REASON_UNREGISTER:
+        case APR_OC_REASON_RESTART:
+        case APR_OC_REASON_UNREGISTER:
+            ap_destroy_pool(pcgi);
             kill(*sd, SIGHUP);
             break;
     }
@@ -321,7 +325,6 @@ static void get_req(int fd, request_rec *r, char **filename, char **argv0, char
     int i, len, j; 
     unsigned char *data; 
     char **environ; 
-    char temp[MAX_STRING_LEN]; 
     core_dir_config *temp_core; 
     void **dconf; 
 
@@ -397,11 +400,8 @@ static void get_req(int fd, request_rec *r, char **filename, char **argv0, char
 static void send_req(int fd, request_rec *r, char *argv0, char **env) 
 { 
     int len; 
-    int rv;
     int i = 0; 
     char *data; 
-    core_dir_config *conf = ap_get_module_config(r->per_dir_config, 
-                                                 &core_module); 
 
     data = ap_pstrcat(r->pool, r->filename, "\n", argv0, "\n", r->uri, "\n", 
                      NULL); 
@@ -566,6 +566,7 @@ static int cgid_server(void *data)
 static void cgid_init(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *main_server) 
 { 
     int pid; 
+    ap_proc_t ap_pid;
     int tempfd;
 
     cgid_server_conf *sconf = (cgid_server_conf *)ap_get_module_config( 
@@ -585,7 +586,9 @@ static void cgid_init(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp, server_re
             exit(-1);
         } 
 #ifdef APR_HAS_OTHER_CHILD
-        ap_register_other_child(pid, cgid_maint, &pid, -1);
+        ap_pid.pid = pid;
+        ap_pid.err = ap_pid.in = ap_pid.out = NULL;
+        ap_register_other_child(&ap_pid, cgid_maint, NULL, NULL, p);
 #endif
     } 
     else once_through++; 
@@ -838,11 +841,11 @@ static int cgid_handler(request_rec *r)
         } 
     } 
 #else 
-    if (r->finfo.st_mode == 0) 
+    if (r->finfo.protection == 0) 
         return log_scripterror(r, conf, NOT_FOUND, APLOG_NOERRNO, 
                                "script not found or unable to stat"); 
 #endif 
-    if (S_ISDIR(r->finfo.st_mode)
+    if (r->finfo.filetype == APR_DIR
         return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, 
                                "attempt to invoke directory as script"); 
 /*
@@ -981,8 +984,6 @@ static int cgid_handler(request_rec *r)
         ap_send_fb(script, r); 
     } 
 
-ap_destroy_pool(pcgi);
-
     return OK; /* NOT r->status, even if it has changed. */ 
 }