]> granicus.if.org Git - apache/blobdiff - server/log.c
use APR_STATUS_IS_TIMEUP() instead of direct comparison with APR_TIMEUP.
[apache] / server / log.c
index 5e618b27b7b9212290a1305ed4af8f54684584e9..50d9cbcb3ede20e6fef25e00f321ee94ac19fc86 100644 (file)
@@ -1131,27 +1131,30 @@ static void log_error_core(const char *file, int line, int module_index,
             }
         }
 
-        sconf = ap_get_module_config(s->module_config, &core_module);
-        if (c && !c->log_id) {
-            add_log_id(c, NULL);
-            if (sconf->error_log_conn && sconf->error_log_conn->nelts > 0)
-                log_conn_info = 1;
-        }
-        if (r) {
-            if (r->main)
-                rmain = r->main;
-            else
-                rmain = r;
-
-            if (!rmain->log_id) {
-                /* XXX: do we need separate log ids for subrequests? */
-                if (sconf->error_log_req && sconf->error_log_req->nelts > 0)
-                    log_req_info = 1;
-                /*
-                 * XXX: potential optimization: only create log id if %L is
-                 * XXX: actually used
-                 */
-                add_log_id(c, rmain);
+        /* the faked server_rec from mod_cgid does not have s->module_config */
+        if (s->module_config) {
+            sconf = ap_get_module_config(s->module_config, &core_module);
+            if (c && !c->log_id) {
+                add_log_id(c, NULL);
+                if (sconf->error_log_conn && sconf->error_log_conn->nelts > 0)
+                    log_conn_info = 1;
+            }
+            if (r) {
+                if (r->main)
+                    rmain = r->main;
+                else
+                    rmain = r;
+
+                if (!rmain->log_id) {
+                    /* XXX: do we need separate log ids for subrequests? */
+                    if (sconf->error_log_req && sconf->error_log_req->nelts > 0)
+                        log_req_info = 1;
+                    /*
+                     * XXX: potential optimization: only create log id if %L is
+                     * XXX: actually used
+                     */
+                    add_log_id(c, rmain);
+                }
             }
         }
     }
@@ -1358,6 +1361,25 @@ AP_DECLARE(void) ap_log_command_line(apr_pool_t *plog, server_rec *s)
                  "Command line: '%s'", result);
 }
 
+AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *rel_fname)
+{
+    apr_status_t rv;
+    const char *fname = ap_server_root_relative(p, rel_fname);
+
+    if (fname != NULL) {
+        rv = apr_file_remove(fname, p);
+        if (rv != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf,
+                         "failed to remove PID file %s", fname);
+        }
+        else {
+            ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf,
+                         "removed PID file %s (pid=%" APR_PID_T_FMT ")",
+                         fname, getpid());
+        }
+    }
+}
+
 AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *filename)
 {
     apr_file_t *pid_file = NULL;