You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/12/28 15:54:50 UTC
svn commit: r1225199 - in /httpd/httpd/trunk:
docs/log-message-tags/next-number server/core.c
Author: sf
Date: Wed Dec 28 14:54:49 2011
New Revision: 1225199
URL: http://svn.apache.org/viewvc?rev=1225199&view=rev
Log:
Check during configtest that the directories for error logs exist
Testing under Windows is welcome
PR: 29941
Modified:
httpd/httpd/trunk/docs/log-message-tags/next-number
httpd/httpd/trunk/server/core.c
Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1225199&r1=1225198&r2=1225199&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Wed Dec 28 14:54:49 2011
@@ -1 +1 @@
-2291
+2292
Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1225199&r1=1225198&r2=1225199&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Dec 28 14:54:49 2011
@@ -4342,6 +4342,44 @@ AP_DECLARE(int) ap_sys_privileges_handle
return sys_privileges;
}
+static int check_errorlog_dir(apr_pool_t *p, server_rec *s)
+{
+ if (s->error_fname[0] == '|' && strcmp(s->error_fname, "syslog") == 0) {
+ return APR_SUCCESS;
+ }
+ else {
+ char *abs = ap_server_root_relative(p, s->error_fname);
+ char *dir = ap_make_dirstr_parent(p, abs);
+ apr_finfo_t finfo;
+ apr_status_t rv = apr_stat(&finfo, dir, APR_FINFO_TYPE, p);
+ if (rv == APR_SUCCESS && finfo.filetype != APR_DIR)
+ rv = APR_ENOTDIR;
+ if (rv != APR_SUCCESS) {
+ const char *desc = "main error log";
+ if (s->defn_name)
+ desc = apr_psprintf(p, "error log of vhost defined at %s:%d",
+ s->defn_name, s->defn_line_number);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_EMERG, rv,
+ ap_server_conf, APLOGNO(02291)
+ "Cannot access directory '%s' for %s", dir, desc);
+ return !OK;
+ }
+ }
+ return OK;
+}
+
+static int core_check_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
+{
+ int rv = OK;
+ while (s) {
+ if (check_errorlog_dir(ptemp, s) != OK)
+ rv = !OK;
+ s = s->next;
+ }
+ return rv;
+}
+
+
static int core_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
{
ap_mutex_init(pconf);
@@ -4737,6 +4775,7 @@ static void register_hooks(apr_pool_t *p
ap_hook_pre_config(core_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
ap_hook_post_config(core_post_config,NULL,NULL,APR_HOOK_REALLY_FIRST);
+ ap_hook_check_config(core_check_config,NULL,NULL,APR_HOOK_FIRST);
ap_hook_test_config(core_dump_config,NULL,NULL,APR_HOOK_FIRST);
ap_hook_translate_name(ap_core_translate,NULL,NULL,APR_HOOK_REALLY_LAST);
ap_hook_map_to_storage(core_map_to_storage,NULL,NULL,APR_HOOK_REALLY_LAST);