From: William A. Rowe Jr Date: Sun, 13 Oct 2002 03:25:04 +0000 (+0000) Subject: Some errors are impossible to fathom, without the user knowing certain X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=963c08549360373744f76ebf1f22df7685834eca;p=apache Some errors are impossible to fathom, without the user knowing certain base numbers. This patch introduces "(EAP ##): Eap message" for the EAP errors, "(OS ##): Message" for modestly numbered os errors (under 100000) and hex "(OS 0x########): Message" for huge errors, which generally have bit-flag meanings and are usually represented in hex. This should make recognizing user bugreports a little less difficult. Would have done the same for other ranges, but they don't have (as) obvious numeric meanings on their own. Finally, we free up a buffer copy and give apr_strerror our string buffer to directly populate the message text. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97191 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/log.c b/server/log.c index 24c8034262..15981aaa37 100644 --- a/server/log.c +++ b/server/log.c @@ -500,10 +500,29 @@ static void log_error_core(const char *file, int line, int level, "[client %s] ", r->connection->remote_ip); } if (status != 0) { - char buf[120]; - len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, - "(%d)%s: ", status, - apr_strerror(status, buf, sizeof(buf))); + if (status < APR_OS_START_EAIERR) { + len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, + "(%d)", status); + } + else if (status < APR_OS_START_SYSERR) { + len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, + "(EAI %d)", status - APR_OS_START_EAIERR); + } + else if (status < 100000 + APR_OS_START_SYSERR) { + len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, + "(OS %d)", status - APR_OS_START_SYSERR); + } + else { + len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, + "(os 0x%08x)", status - APR_OS_START_SYSERR); + } + apr_strerror(status, errstr + len, MAX_STRING_LEN - len); + len += strlen(errstr + len); + if (MAX_STRING_LEN - len > 2) { + errstr[len++] = ':'; + errstr[len++] = ' '; + errstr[len] = '\0'; + } } errstrlen = len; len += apr_vsnprintf(errstr + len, MAX_STRING_LEN - len, fmt, args);