]> granicus.if.org Git - apache/commitdiff
prevent module from segfaulting when not configured.
authorAndré Malo <nd@apache.org>
Fri, 2 Jan 2004 23:35:59 +0000 (23:35 +0000)
committerAndré Malo <nd@apache.org>
Fri, 2 Jan 2004 23:35:59 +0000 (23:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102145 13f79535-47bb-0310-9956-ffa450edef68

modules/loggers/mod_log_forensic.c

index 23aadf0d743aba9257c47b92cd08e759321deaa0..16f17e90d59253ececcf62de05d812879e28dc10 100644 (file)
@@ -222,6 +222,10 @@ static int log_before(request_rec *r)
     int n;
     apr_status_t rv;
 
+    if (!cfg->fd) {
+        return DECLINED;
+    }
+
     if (!(id = apr_table_get(r->subprocess_env, "UNIQUE_ID"))) {
         /* we make the assumption that we can't go through all the PIDs in
            under 1 second */
@@ -270,6 +274,10 @@ static int log_after(request_rec *r)
     int l,n;
     apr_status_t rv;
 
+    if (!cfg->fd) {
+        return DECLINED;
+    }
+
     s = apr_pstrcat(r->pool, "-", id, "\n", NULL);
     l = n = strlen(s);
     rv = apr_file_write(cfg->fd, s, &n);