fix possible fd leak, unrestored cancellation state on dns socket fail
[musl.git] / src / network / hstrerror.c
bloba4d001c53410a0faeee07d5e7e93ec62a917d027
1 #define _GNU_SOURCE
2 #include <netdb.h>
3 #include "locale_impl.h"
5 static const char msgs[] =
6 "Host not found\0"
7 "Try again\0"
8 "Non-recoverable error\0"
9 "Address not available\0"
10 "\0Unknown error";
12 const char *hstrerror(int ecode)
14 const char *s;
15 for (s=msgs, ecode--; ecode && *s; ecode--, s++) for (; *s; s++);
16 if (!*s) s++;
17 return LCTRANS_CUR(s);