Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
09a6c909
Commit
09a6c909
authored
Aug 25, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bogus freeaddrinfo() call in WIN32 code, extend gai_strerror to
cover more error codes. Per Petr Jelinek.
parent
1a334362
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
9 deletions
+49
-9
src/include/getaddrinfo.h
src/include/getaddrinfo.h
+14
-2
src/port/getaddrinfo.c
src/port/getaddrinfo.c
+35
-7
No files found.
src/include/getaddrinfo.h
View file @
09a6c909
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
*
*
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.1
5 2005/07/27 12:44:10 neilc
Exp $
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.1
6 2005/08/25 17:50:59 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
/* Various macros that ought to be in <netdb.h>, but might not be */
/* Various macros that ought to be in <netdb.h>, but might not be */
#ifndef EAI_FAIL
#ifndef EAI_FAIL
#ifndef WIN32
#define EAI_BADFLAGS (-1)
#define EAI_BADFLAGS (-1)
#define EAI_NONAME (-2)
#define EAI_NONAME (-2)
#define EAI_AGAIN (-3)
#define EAI_AGAIN (-3)
...
@@ -40,7 +41,18 @@
...
@@ -40,7 +41,18 @@
#define EAI_SERVICE (-8)
#define EAI_SERVICE (-8)
#define EAI_MEMORY (-10)
#define EAI_MEMORY (-10)
#define EAI_SYSTEM (-11)
#define EAI_SYSTEM (-11)
#endif
#else
/* WIN32 */
#define EAI_AGAIN WSATRY_AGAIN
#define EAI_BADFLAGS WSAEINVAL
#define EAI_FAIL WSANO_RECOVERY
#define EAI_FAMILY WSAEAFNOSUPPORT
#define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
#define EAI_NODATA WSANO_DATA
#define EAI_NONAME WSAHOST_NOT_FOUND
#define EAI_SERVICE WSATYPE_NOT_FOUND
#define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
#endif
/* !WIN32 */
#endif
/* !EAI_FAIL */
#ifndef AI_PASSIVE
#ifndef AI_PASSIVE
#define AI_PASSIVE 0x0001
#define AI_PASSIVE 0x0001
...
...
src/port/getaddrinfo.c
View file @
09a6c909
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.1
8 2005/08/24 22:13:23
tgl Exp $
* $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.1
9 2005/08/25 17:51:01
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -103,9 +103,12 @@ haveNativeWindowsIPv6routines(void)
...
@@ -103,9 +103,12 @@ haveNativeWindowsIPv6routines(void)
{
{
/* We found a dll, so now get the addresses of the routines */
/* We found a dll, so now get the addresses of the routines */
getaddrinfo_ptr
=
GetProcAddress
(
hLibrary
,
"getaddrinfo"
);
getaddrinfo_ptr
=
(
getaddrinfo_ptr_t
)
GetProcAddress
(
hLibrary
,
freeaddrinfo_ptr
=
GetProcAddress
(
hLibrary
,
"freeaddrinfo"
);
"getaddrinfo"
);
getnameinfo_ptr
=
GetProcAddress
(
hLibrary
,
"getnameinfo"
);
freeaddrinfo_ptr
=
(
freeaddrinfo_ptr_t
)
GetProcAddress
(
hLibrary
,
"freeaddrinfo"
);
getnameinfo_ptr
=
(
getnameinfo_ptr_t
)
GetProcAddress
(
hLibrary
,
"getnameinfo"
);
/*
/*
* If any one of the routines is missing, let's play it safe and
* If any one of the routines is missing, let's play it safe and
...
@@ -277,7 +280,7 @@ freeaddrinfo(struct addrinfo * res)
...
@@ -277,7 +280,7 @@ freeaddrinfo(struct addrinfo * res)
*/
*/
if
(
haveNativeWindowsIPv6routines
())
if
(
haveNativeWindowsIPv6routines
())
{
{
(
*
freeaddrinfo_ptr
)
(
node
,
service
,
hintp
,
res
);
(
*
freeaddrinfo_ptr
)
(
res
);
return
;
return
;
}
}
#endif
#endif
...
@@ -310,6 +313,7 @@ gai_strerror(int errcode)
...
@@ -310,6 +313,7 @@ gai_strerror(int errcode)
}
}
return
hstrerror
(
hcode
);
return
hstrerror
(
hcode
);
#else
/* !HAVE_HSTRERROR */
#else
/* !HAVE_HSTRERROR */
switch
(
errcode
)
switch
(
errcode
)
...
@@ -318,7 +322,31 @@ gai_strerror(int errcode)
...
@@ -318,7 +322,31 @@ gai_strerror(int errcode)
return
"Unknown host"
;
return
"Unknown host"
;
case
EAI_AGAIN
:
case
EAI_AGAIN
:
return
"Host name lookup failure"
;
return
"Host name lookup failure"
;
case
EAI_FAIL
:
/* Errors below are probably WIN32 only */
#ifdef EAI_BADFLAGS
case
EAI_BADFLAGS
:
return
"Invalid argument"
;
#endif
#ifdef EAI_FAMILY
case
EAI_FAMILY
:
return
"Address family not supported"
;
#endif
#ifdef EAI_MEMORY
case
EAI_MEMORY
:
return
"Not enough memory"
;
#endif
#ifdef EAI_NODATA
case
EAI_NODATA
:
return
"No host data of that type was found"
;
#endif
#ifdef EAI_SERVICE
case
EAI_SERVICE
:
return
"Class type not found"
;
#endif
#ifdef EAI_SOCKTYPE
case
EAI_SOCKTYPE
:
return
"Socket type not supported"
;
#endif
default:
default:
return
"Unknown server error"
;
return
"Unknown server error"
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment