EAI_SYSTEM and ECANCELED are undefined under cygwin; added

conditional #define.
This commit is contained in:
Abdulaziz Ghuloum 2008-06-08 23:15:25 -07:00
parent c53ffd5314
commit e9ecb1b8b0
3 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,10 @@ typedef struct errno_info {
ikptr c; ikptr c;
} errno_info; } errno_info;
#ifndef ECANCELED
#define ECANCELED 140
#endif
static errno_info errno_table[] = { static errno_info errno_table[] = {
/* errnos from POSIX IEEE Std 1003.1 2004 Edition */ /* errnos from POSIX IEEE Std 1003.1 2004 Edition */
{E2BIG, "E2BIG", fix(-1)}, {E2BIG, "E2BIG", fix(-1)},

View File

@ -33,7 +33,7 @@ getaddrinfo(const char *hostname, const char* servname,
const struct addrinfo* hints, struct addrinfo** res){ const struct addrinfo* hints, struct addrinfo** res){
/* hints not used */ /* hints not used */
struct servent* sent = getservbyname(servname, "tcp"); struct servent* sent = getservbyname(servname, "tcp");
if(sent == 0) return -1; if (sent == 0) return -1;
struct hostent* hent = gethostbyname(hostname); struct hostent* hent = gethostbyname(hostname);
if (!hent){ if (!hent){
return -1; return -1;
@ -57,7 +57,7 @@ getaddrinfo(const char *hostname, const char* servname,
memcpy(&sa_in->sin_addr, *ap, sizeof(struct in_addr)); memcpy(&sa_in->sin_addr, *ap, sizeof(struct in_addr));
r->ai_next = NULL; r->ai_next = NULL;
*res = r; *res = r;
return (0); return 0;
} }
void void

View File

@ -40,5 +40,10 @@ getaddrinfo(const char *hostname, const char* servname,
extern void extern void
freeaddrinfo(struct addrinfo *ai); freeaddrinfo(struct addrinfo *ai);
#ifndef EAI_SYSTEM
# define EAI_SYSTEM 11 /* same code as in glibc */
#endif
#endif #endif