diff options
| author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-11-17 18:03:46 +0000 |
|---|---|---|
| committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-11-17 18:03:46 +0000 |
| commit | 892cc11771a53d7ee30c5334ca2bda56fd6e6c8b (patch) | |
| tree | 3f3bf7d31525b64c671faf04cd468c3c84635f00 /libc/inet/herror.c | |
| parent | 5d96ee84a344a55682848b1338b9bcd0618e341b (diff) | |
| download | uClibc-alpine-892cc11771a53d7ee30c5334ca2bda56fd6e6c8b.tar.bz2 uClibc-alpine-892cc11771a53d7ee30c5334ca2bda56fd6e6c8b.tar.xz | |
Synch with trunk @ 24075.
Step 9: libc/stdio - libc/inet - libc/pwd_grp
Diffstat (limited to 'libc/inet/herror.c')
| -rw-r--r-- | libc/inet/herror.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libc/inet/herror.c b/libc/inet/herror.c index 063f6e93e..b46578388 100644 --- a/libc/inet/herror.c +++ b/libc/inet/herror.c @@ -26,7 +26,7 @@ libc_hidden_proto(fprintf) libc_hidden_proto(__h_errno_location) -static const char *error_msg = "Resolver error"; +static const char error_msg[] = "Resolver error"; static const char *const h_errlist[] = { "Error 0", "Unknown host", /* 1 HOST_NOT_FOUND */ @@ -52,7 +52,7 @@ void herror(const char *s) } p = error_msg; if ((h_errno >= 0) && (h_errno < h_nerr)) { - p = h_errlist[h_errno]; + p = h_errlist[h_errno]; } fprintf(stderr, "%s%s%s\n", s, c, p); } @@ -61,10 +61,8 @@ libc_hidden_def(herror) const char *hstrerror(int err) { - if (err < 0) { - return(error_msg); - } else if (err < h_nerr) { - return(h_errlist[err]); - } - return(error_msg); + if ((unsigned)err < h_nerr) + return(h_errlist[err]); + + return error_msg; } |
