diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c index e05d27dd69..48f55bb365 100644 --- a/modules/dav/main/util.c +++ b/modules/dav/main/util.c @@ -211,8 +211,8 @@ dav_lookup_result dav_lookup_uri(const char *uri, request_rec * r) result.err.status = HTTP_BAD_GATEWAY; result.err.desc = ap_psprintf(r->pool, "Destination URI refers to different " - "scheme or port (%s://hostname:%d)\n" - "(want: %s://hostname:%d)", + "scheme or port (%s://hostname:%d)" + APR_EOL_STR "(want: %s://hostname:%d)", comp.scheme ? comp.scheme : scheme, comp.port ? comp.port : port, scheme, port); diff --git a/modules/experimental/mod_charset_lite.c b/modules/experimental/mod_charset_lite.c index 282d7814d6..c0e55324ab 100644 --- a/modules/experimental/mod_charset_lite.c +++ b/modules/experimental/mod_charset_lite.c @@ -229,14 +229,14 @@ static int find_code_page(request_rec *r) rv = ap_xlate_open(&output_xlate, dc->charset_default, dc->charset_source, r->pool); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "can't open translation %s->%s, error %d\n", - dc->charset_source, dc->charset_default, rv); + "can't open translation %s->%s", + dc->charset_source, dc->charset_default); return HTTP_INTERNAL_SERVER_ERROR; } rv = ap_set_content_xlate(r, 1, output_xlate); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "can't set content output translation, error %d\n", rv); + "can't set content output translation"); return HTTP_INTERNAL_SERVER_ERROR; } @@ -251,14 +251,14 @@ static int find_code_page(request_rec *r) dc->charset_default, r->pool); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "can't open translation %s->%s, error %d\n", - dc->charset_default, dc->charset_source, rv); + "can't open translation %s->%s", + dc->charset_default, dc->charset_source); return HTTP_INTERNAL_SERVER_ERROR; } rv = ap_set_content_xlate(r, 0, input_xlate); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "can't set content input translation, error %d\n", rv); + "can't set content input translation"); return HTTP_INTERNAL_SERVER_ERROR; } } diff --git a/modules/http/http_core.c b/modules/http/http_core.c index f6d4827d46..bbda522eab 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -985,7 +985,7 @@ API_EXPORT (file_type_e) ap_get_win32_interpreter(const request_rec *r, return eFileTypeSCRIPT; } ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server, - "Failed to start a '%s' file as a script.\n\t" + "Failed to start a '%s' file as a script.\r\n\t" "COMSPEC variable is missing from the environment.", ext); return eFileTypeUNKNOWN; } @@ -1005,15 +1005,15 @@ API_EXPORT (file_type_e) ap_get_win32_interpreter(const request_rec *r, return eFileTypeSCRIPT; else if (d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY_STRICT) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server, - "ScriptInterpreterSource config directive set to \"registry-strict\".\n\t" - "Interpreter not found for files of type '%s'.", ext); + "ScriptInterpreterSource config directive set to \"registry-strict\"." APR_EOL_STR + "\tInterpreter not found for files of type '%s'.", ext); return eFileTypeUNKNOWN; } else { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server, - "ScriptInterpreterSource config directive set to \"registry\".\n\t" - "Interpreter not found for files of type '%s', " + "ScriptInterpreterSource config directive set to \"registry\"." APR_EOL_STR + "\tInterpreter not found for files of type '%s', " "trying \"script\" method...", ext); } } diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 0e68a72fe8..9c2ee29a1d 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -885,7 +885,7 @@ int ap_proxy_is_ipaddr(struct dirconn_entry *This, ap_pool_t *p) This->mask.s_addr = htonl(INADDR_NONE << (32 - bits)); if (*addr == '\0' && (This->addr.s_addr & ~This->mask.s_addr) != 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Warning: NetMask and IP-Addr disagree in %s/%ld\n", + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Warning: NetMask and IP-Addr disagree in %s/%ld", inet_ntoa(This->addr), bits); This->addr.s_addr &= This->mask.s_addr; ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, diff --git a/server/config.c b/server/config.c index 6d4ce013ed..cc64d99b9b 100644 --- a/server/config.c +++ b/server/config.c @@ -1077,7 +1077,7 @@ API_EXPORT(const char *) ap_build_config(cmd_parms *parms, while (curr_parent != NULL) { errmsg = ap_psprintf(p, "%s%s%s:%u: %s> was not closed.", errmsg, - *errmsg == '\0' ? "" : "\n", + *errmsg == '\0' ? "" : APR_EOL_STR, curr_parent->filename, curr_parent->line_num, curr_parent->directive); @@ -1273,7 +1273,8 @@ static void process_command_config(server_rec *s, ap_array_header_t *arr, errmsg = ap_build_config(&parms, p, ptemp, conftree); if (errmsg) { ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Syntax error in -C/-c directive:\n%s", errmsg); + "Syntax error in -C/-c directive:" APR_EOL_STR "%s", + errmsg); exit(1); } diff --git a/server/log.c b/server/log.c index 880e7d1bad..717263c397 100644 --- a/server/log.c +++ b/server/log.c @@ -322,7 +322,7 @@ static void log_error_core(const char *file, int line, int level, const request_rec *r, ap_pool_t *pool, const char *fmt, va_list args) { - char errstr[MAX_STRING_LEN + 1]; /* + 1 to have room for '\n' */ + char errstr[MAX_STRING_LEN]; size_t len; ap_file_t *logf = NULL; @@ -427,12 +427,11 @@ static void log_error_core(const char *file, int line, int level, /* NULL if we are logging to syslog */ if (logf) { - /* We know that we have one more character of space available because - * the array is sized that way */ - /* ap_assert(len < MAX_STRING_LEN) */ - errstr[len++] = '\n'; - errstr[len] = '\0'; - ap_puts(errstr, logf); + /* Truncate for the terminator (as ap_snprintf does) */ + if (len > MAX_STRING_LEN - 2) + len = MAX_STRING_LEN - 2; + strcpy(errstr + len, APR_EOL_STR); + ap_puts(errstr, logf); ap_flush(logf); } #ifdef HAVE_SYSLOG @@ -528,7 +527,7 @@ void ap_log_pid(ap_pool_t *p, const char *fname) ap_server_argv0, fname); exit(1); } - ap_fprintf(pid_file, "%ld\n", (long)mypid); + ap_fprintf(pid_file, "%ld" APR_EOL_STR, (long)mypid); ap_close(pid_file); saved_pid = mypid; } diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index e985497b48..3eefd3c741 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -991,7 +991,7 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, const cha if (ap_threads_per_child > HARD_THREAD_LIMIT) { ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "WARNING: ThreadsPerChild of %d exceeds compile time" - "limit of %d threads,\n", ap_threads_per_child, + "limit of %d threads,", ap_threads_per_child, HARD_THREAD_LIMIT); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " lowering ThreadsPerChild to %d. To increase, please" diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index c37a7681d2..6c5c199202 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -985,7 +985,7 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg if (ap_threads_per_child > HARD_THREAD_LIMIT) { ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "WARNING: ThreadsPerChild of %d exceeds compile time" - "limit of %d threads,\n", ap_threads_per_child, + "limit of %d threads,", ap_threads_per_child, HARD_THREAD_LIMIT); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " lowering ThreadsPerChild to %d. To increase, please" diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 8f5cdb7ea7..b0c1807e29 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1307,7 +1307,7 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, ap_daemons_limit = HARD_SERVER_LIMIT; } else if (ap_daemons_limit < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "WARNING: Require MaxClients > 0, setting to 1\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "WARNING: Require MaxClients > 0, setting to 1"); ap_daemons_limit = 1; } return NULL; diff --git a/server/mpm_common.c b/server/mpm_common.c index f99d6d7aee..2e1df1da9d 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -232,7 +232,7 @@ void ap_process_child_status(ap_proc_t *pid, ap_wait_t status) if ((WIFEXITED(status)) && WEXITSTATUS(status) == APEXIT_CHILDFATAL) { ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf, - "Child %ld returned a Fatal error... \n" + "Child %ld returned a Fatal error..." APR_EOL_STR "Apache is exiting!", (long)pid->pid); exit(APEXIT_CHILDFATAL); diff --git a/server/util.c b/server/util.c index 061355e8e4..7f84a806b8 100644 --- a/server/util.c +++ b/server/util.c @@ -1893,7 +1893,7 @@ char *ap_get_local_host(ap_pool_t *a) #endif { ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_WARNING, 0, NULL, - "%s: gethostname() failed to detemine ServerName\n", + "%s: gethostname() failed to detemine ServerName", ap_server_argv0); } else @@ -1919,7 +1919,7 @@ char *ap_get_local_host(ap_pool_t *a) ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, NULL, "%s: Could not find determine the server's fully qualified " - "domain name, using %s for ServerName\n", + "domain name, using %s for ServerName", ap_server_argv0, server_hostname); return server_hostname;