]> granicus.if.org Git - apache/commitdiff
Some errors are impossible to fathom, without the user knowing certain
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 13 Oct 2002 03:25:04 +0000 (03:25 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 13 Oct 2002 03:25:04 +0000 (03:25 +0000)
  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

server/log.c

index 24c8034262ae614646938223ca6446b05b378f70..15981aaa3754c2d23773b8a1321a50f4c12b3fd0 100644 (file)
@@ -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);