--- httpd-2.2.22.original/server/core.c 2011-09-08 12:59:38.000000000 -0300 +++ httpd-2.2.22/server/core.c 2012-08-01 00:01:48.000000000 -0300 @@ -2334,6 +2334,39 @@ return NULL; } + +static const char *ap_pstrftime(apr_pool_t *p, const char *format) { + size_t got, len = strlen(format) + 1; + const char *fp = strchr(format, '%'); + char *buf = NULL; + apr_time_exp_t strftime_tm; + apr_time_exp_lt(&strftime_tm, apr_time_now()); + while (NULL != fp) { + len += 10; + fp = strchr(fp + 1, '%'); + } + + buf = apr_palloc(p, len); + apr_strftime(buf, &got, len, format, &strftime_tm); + return buf; +} + +static const char *set_error_log(cmd_parms *cmd, void *dummy, + const char *arg) +{ + const char *err = ap_check_cmd_context(cmd, + NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); + if (err != NULL) { + return err; + } + + char* error_fname; + error_fname = apr_pstrdup(cmd->pool,ap_pstrftime(cmd->pool, arg)); + cmd->server->error_fname = error_fname; + + return NULL; +} + /* * The ServerName directive takes one argument with format * [scheme://]fully-qualified-domain-name[:port], for instance @@ -3394,8 +3427,7 @@ "En-/disable server signature (on|off|email)"), AP_INIT_TAKE1("ServerRoot", set_server_root, NULL, RSRC_CONF | EXEC_ON_READ, "Common directory of server-related files (logs, confs, etc.)"), -AP_INIT_TAKE1("ErrorLog", set_server_string_slot, - (void *)APR_OFFSETOF(server_rec, error_fname), RSRC_CONF, +AP_INIT_TAKE1("ErrorLog", set_error_log, NULL, RSRC_CONF, "The filename of the error log"), AP_INIT_RAW_ARGS("ServerAlias", set_server_alias, NULL, RSRC_CONF, "A name or names alternately used to access the server"),