summaryrefslogtreecommitdiff
path: root/libc/inet
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-02 07:43:59 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-02 07:43:59 +0000
commitd62a439a4f32e8e2f8b9c437688b9fc7db91f437 (patch)
treec6d0cd40185f8523c30f5ba5e42c1b227e8f27d8 /libc/inet
parentef91508f142522306f52dc20108c0597c2857485 (diff)
Fix hstrerror
Diffstat (limited to 'libc/inet')
-rw-r--r--libc/inet/herror.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libc/inet/herror.c b/libc/inet/herror.c
index 51b858f54..06ab6d5f8 100644
--- a/libc/inet/herror.c
+++ b/libc/inet/herror.c
@@ -25,12 +25,13 @@
#ifdef L_herror
+static const char *error_msg = "Resolver error";
static const char *const h_errlist[] = {
"Error 0",
- "Unknown host", /* 1 HOST_NOT_FOUND */
- "Host name lookup failure", /* 2 TRY_AGAIN */
- "Unknown server error", /* 3 NO_RECOVERY */
- "No address associated with name", /* 4 NO_ADDRESS */
+ "Unknown host", /* 1 HOST_NOT_FOUND */
+ "Host name lookup failure", /* 2 TRY_AGAIN */
+ "Unknown server error", /* 3 NO_RECOVERY */
+ "No address associated with name", /* 4 NO_ADDRESS */
};
static const int h_nerr = { sizeof(h_errlist)/sizeof(h_errlist[0]) };
@@ -47,7 +48,7 @@ void herror(const char *s)
if (!s || !*s) {
c += 2;
}
- p = "Unknown error";
+ p = error_msg;
if ((h_errno >= 0) && (h_errno < h_nerr)) {
p = h_errlist[h_errno];
}
@@ -59,6 +60,11 @@ void herror(const char *s)
#ifdef L_hstrerror
const char *hstrerror(int err)
{
- return(strerror(err));
+ if (err < 0) {
+ return(error_msg);
+ } else if (err < h_nerr) {
+ return(h_errlist[err]);
+ }
+ return(error_msg);
}
#endif