| 58 | #endif |
| 59 | |
| 60 | static int check_hostent_err(struct hostent *hp) |
| 61 | { |
| 62 | #ifndef INET6 |
| 63 | extern int h_errno; |
| 64 | #endif |
| 65 | if (!hp) { |
| 66 | switch (h_errno) { |
| 67 | case HOST_NOT_FOUND: |
| 68 | case NO_DATA: |
| 69 | return EAI_NONAME; |
| 70 | case TRY_AGAIN: |
| 71 | return EAI_AGAIN; |
| 72 | case NO_RECOVERY: |
| 73 | default: |
| 74 | return EAI_FAIL; |
| 75 | } |
| 76 | } |
| 77 | if (!hp->h_name || hp->h_addrtype != AF_INET) { |
| 78 | return EAI_FAIL; |
| 79 | } |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | static char *canon_name_from_hostent(struct hostent *hp, |
| 84 | int *perr) |
no outgoing calls
no test coverage detected