diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-04-16 13:21:03 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-04-16 13:21:35 -0400 |
commit | 9ad94ba08491f3300d54f0df954363ae5fe439d4 (patch) | |
tree | dbf8fa62e6997648e5180723250d3cff84b4828f | |
parent | c4bf15b9c3f80da78e1c5c32c8063c3146f85af8 (diff) | |
download | postgresql-9ad94ba08491f3300d54f0df954363ae5fe439d4.tar.gz postgresql-9ad94ba08491f3300d54f0df954363ae5fe439d4.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.
-rw-r--r-- | src/backend/libpq/hba.c | 2 | ||||
-rw-r--r-- | src/backend/port/pipe.c | 2 | ||||
-rw-r--r-- | src/backend/postmaster/pgstat.c | 2 | ||||
-rw-r--r-- | src/bin/initdb/initdb.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 715e72a92a5..472a960728a 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -971,7 +971,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) /* 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/port/pipe.c b/src/backend/port/pipe.c index b249e959107..2865204e6d2 100644 --- a/src/backend/port/pipe.c +++ b/src/backend/port/pipe.c @@ -55,7 +55,7 @@ pgpipe(int handles[2]) closesocket(s); return -1; } - if ((handles[1] = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) + if ((handles[1] = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { ereport(LOG, (errmsg_internal("pgpipe could not create socket 2: %ui", WSAGetLastError()))); closesocket(s); diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index e1e60294ea0..67a7122a1ff 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -316,7 +316,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 64a2604f5b9..9bc3e2364e9 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1053,7 +1053,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; |