diff options
-rw-r--r-- | libc/inet/herror.c | 14 | ||||
-rw-r--r-- | libc/inet/resolv.c | 6 | ||||
-rw-r--r-- | libc/misc/mntent/mntent.c | 3 |
3 files changed, 12 insertions, 11 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; } diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index e38c8bd67..70db2b738 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -2625,12 +2625,14 @@ libc_hidden_def(ns_name_uncompress) * The root is returned as "." * All other domains are returned in non absolute form */ -int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) { +int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) +{ + static const char digits[] = "0123456789"; + const u_char *cp; char *dn, *eom; u_char c; u_int n; - const char digits[] = "0123456789"; cp = src; dn = dst; diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index f4220784a..4d23aef00 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -30,8 +30,9 @@ libc_hidden_proto(fprintf) struct mntent *getmntent_r (FILE *filep, struct mntent *mnt, char *buff, int bufsize) { + static const char sep[] = " \t\n"; + char *cp, *ptrptr; - const char *sep = " \t\n"; if (!filep || !mnt || !buff) return NULL; |