aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-04-16 13:21:00 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-04-16 13:21:31 -0400
commitbac05d622dd9a1186cb81ac09b04736b815b6226 (patch)
tree35750b5e19b3c6a9d914f8d7d1204008fe992bd0 /src
parentb764080eed128e4ab15db801923ef13c45b506b2 (diff)
downloadpostgresql-bac05d622dd9a1186cb81ac09b04736b815b6226.tar.gz
postgresql-bac05d622dd9a1186cb81ac09b04736b815b6226.zip
Use AF_UNSPEC not PF_UNSPEC in getaddrinfo calls.
According to the Single Unix Spec and assorted man pages, you're supposed to use the constants named AF_xxx when setting ai_family for a getaddrinfo call. In a few places we were using PF_xxx instead. Use of PF_xxx appears to be an ancient BSD convention that was not adopted by later standardization. On BSD and most later Unixen, it doesn't matter much because those constants have equivalent values anyway; but nonetheless this code is not per spec. In the same vein, replace PF_INET by AF_INET in one socket() call, which wasn't even consistent with the other socket() call in the same function let alone the remainder of our code. Per investigation of a Cygwin trouble report from Marco Atzeri. It's probably a long shot that this will fix his issue, but it's wrong in any case.
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/hba.c2
-rw-r--r--src/backend/postmaster/pgstat.c2
-rw-r--r--src/bin/initdb/initdb.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 09e8715c798..1a562cbdb99 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -1015,7 +1015,7 @@ parse_hba_line(List *line, int line_num)
/* Get the IP address either way */
hints.ai_flags = AI_NUMERICHOST;
- hints.ai_family = PF_UNSPEC;
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = 0;
hints.ai_protocol = 0;
hints.ai_addrlen = 0;
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 214d1849a13..c2fa6013d3a 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -319,7 +319,7 @@ pgstat_init(void)
* Create the UDP socket for sending and receiving statistic messages
*/
hints.ai_flags = AI_PASSIVE;
- hints.ai_family = PF_UNSPEC;
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = 0;
hints.ai_addrlen = 0;
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 3ed16d62b53..cb0f021aac2 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1108,7 +1108,7 @@ setup_config(void)
/* for best results, this code should match parse_hba() */
hints.ai_flags = AI_NUMERICHOST;
- hints.ai_family = PF_UNSPEC;
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = 0;
hints.ai_protocol = 0;
hints.ai_addrlen = 0;