Skip to content

Commit d862045

Browse files
committed
Don't use HAVE_STRUCT_ADDRINFO as a guide to whether netdb.h defines
macros like AI_NUMERICHOST; instead, test the macros individually. Should fix recent reports of trouble on AIX and Unixware.
1 parent d829560 commit d862045

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

src/include/getaddrinfo.h

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* Copyright (c) 2003, PostgreSQL Global Development Group
1717
*
18-
* $Id: getaddrinfo.h,v 1.8 2003/08/04 00:43:29 momjian Exp $
18+
* $Id: getaddrinfo.h,v 1.9 2003/08/07 16:45:21 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -28,43 +28,60 @@
2828
#endif
2929

3030

31-
#ifndef HAVE_STRUCT_ADDRINFO
31+
/* Various macros that ought to be in <netdb.h>, but might not be */
3232

33-
struct addrinfo
34-
{
35-
int ai_flags;
36-
int ai_family;
37-
int ai_socktype;
38-
int ai_protocol;
39-
size_t ai_addrlen;
40-
struct sockaddr *ai_addr;
41-
char *ai_canonname;
42-
struct addrinfo *ai_next;
43-
};
33+
#ifndef EAI_FAIL
4434

45-
#define EAI_BADFLAGS -1
35+
#define EAI_BADFLAGS -1
4636
#define EAI_NONAME -2
4737
#define EAI_AGAIN -3
4838
#define EAI_FAIL -4
4939
#define EAI_FAMILY -6
50-
#define EAI_SOCKTYPE -7
40+
#define EAI_SOCKTYPE -7
5141
#define EAI_SERVICE -8
5242
#define EAI_MEMORY -10
5343
#define EAI_SYSTEM -11
5444

45+
#endif
46+
47+
#ifndef AI_PASSIVE
5548
#define AI_PASSIVE 0x0001
49+
#endif
50+
#ifndef AI_NUMERICHOST
5651
#define AI_NUMERICHOST 0x0004
52+
#endif
5753

54+
#ifndef NI_NUMERICHOST
5855
#define NI_NUMERICHOST 1
56+
#endif
57+
#ifndef NI_NUMERICSERV
5958
#define NI_NUMERICSERV 2
60-
#endif /* HAVE_STRUCT_ADDRINFO */
59+
#endif
6160

6261
#ifndef NI_MAXHOST
6362
#define NI_MAXHOST 1025
63+
#endif
64+
#ifndef NI_MAXSERV
6465
#define NI_MAXSERV 32
6566
#endif
6667

6768

69+
#ifndef HAVE_STRUCT_ADDRINFO
70+
71+
struct addrinfo
72+
{
73+
int ai_flags;
74+
int ai_family;
75+
int ai_socktype;
76+
int ai_protocol;
77+
size_t ai_addrlen;
78+
struct sockaddr *ai_addr;
79+
char *ai_canonname;
80+
struct addrinfo *ai_next;
81+
};
82+
83+
#endif /* HAVE_STRUCT_ADDRINFO */
84+
6885

6986
#ifndef HAVE_GETADDRINFO
7087

@@ -96,6 +113,7 @@ extern const char *gai_strerror(int errcode);
96113
extern int getnameinfo(const struct sockaddr * sa, int salen,
97114
char *node, int nodelen,
98115
char *service, int servicelen, int flags);
116+
99117
#endif /* HAVE_GETADDRINFO */
100118

101119
#endif /* GETADDRINFO_H */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy