if errno != 0, err() prints the errno string... yet err() is called sometimes when errno is irrelevant; large-scale rework of error handling would be nice, but this at least helps a bit in the meantime
Index: src/support/ab.c =================================================================== RCS file: /home/cvs/apache-1.3/src/support/ab.c,v retrieving revision 1.72 diff -u -r1.72 ab.c --- src/support/ab.c 7 Jan 2004 18:55:50 -0000 1.72 +++ src/support/ab.c 14 Jan 2004 12:01:20 -0000 @@ -1066,6 +1066,7 @@ */ ab_close(c->fd); if (bad++ > 10) { + errno = 0; /* errno not set for parse error */ err("\nTest aborted after 10 failures\n\n"); } FD_CLR(c->fd, &writebits); @@ -1238,6 +1239,7 @@ char theerror[1024]; ap_snprintf(theerror, sizeof(theerror), "Bad hostname: %s\n", connecthost); + errno = 0; /* errno not necessarily set by gethostbyname() */ err(theerror); } server.sin_family = he->h_addrtype; @@ -1321,6 +1323,7 @@ timeout.tv_usec = 0; n = ap_select(FD_SETSIZE, &sel_read, &sel_write, &sel_except, &timeout); if (!n) { + errno = 0; /* errno not set when ap_select()->0 */ err("\nServer timed out\n\n"); } if (n < 1) @@ -1554,14 +1557,17 @@ confidence = 0; break; case 'i': - if (posting == 1) + if (posting == 1) { + errno = 0; /* errno not meaningful */ err("Cannot mix POST and HEAD"); - + } posting = -1; break; case 'p': - if (posting != 0) + if (posting != 0) { + errno = 0; err("Cannot mix POST and HEAD"); + } if (0 == (r = open_postfile(optarg))) { posting = 1;