Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcad4fe6

Browse files
committed
Use AF_UNSPEC not PF_UNSPEC in getaddrinfo calls.
According to the Single Unix Spec and assorted man pages, you're supposedto use the constants named AF_xxx when setting ai_family for a getaddrinfocall. In a few places we were using PF_xxx instead. Use of PF_xxxappears to be an ancient BSD convention that was not adopted by laterstandardization. On BSD and most later Unixen, it doesn't matter muchbecause those constants have equivalent values anyway; but nonethelessthis code is not per spec.In the same vein, replace PF_INET by AF_INET in one socket() call, whichwasn't even consistent with the other socket() call in the same functionlet alone the remainder of our code.Per investigation of a Cygwin trouble report from Marco Atzeri. It'sprobably a long shot that this will fix his issue, but it's wrong inany case.
1 parent585bca3 commitcad4fe6

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

‎src/backend/libpq/hba.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ parse_hba_line(List *line, int line_num, char *raw_line)
10411041

10421042
/* Get the IP address either way */
10431043
hints.ai_flags=AI_NUMERICHOST;
1044-
hints.ai_family=PF_UNSPEC;
1044+
hints.ai_family=AF_UNSPEC;
10451045
hints.ai_socktype=0;
10461046
hints.ai_protocol=0;
10471047
hints.ai_addrlen=0;

‎src/backend/postmaster/pgstat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ pgstat_init(void)
348348
* Create the UDP socket for sending and receiving statistic messages
349349
*/
350350
hints.ai_flags=AI_PASSIVE;
351-
hints.ai_family=PF_UNSPEC;
351+
hints.ai_family=AF_UNSPEC;
352352
hints.ai_socktype=SOCK_DGRAM;
353353
hints.ai_protocol=0;
354354
hints.ai_addrlen=0;

‎src/bin/initdb/initdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ setup_config(void)
13541354

13551355
/* for best results, this code should match parse_hba() */
13561356
hints.ai_flags=AI_NUMERICHOST;
1357-
hints.ai_family=PF_UNSPEC;
1357+
hints.ai_family=AF_UNSPEC;
13581358
hints.ai_socktype=0;
13591359
hints.ai_protocol=0;
13601360
hints.ai_addrlen=0;

‎src/bin/pg_dump/parallel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ pgpipe(int handles[2])
13631363
closesocket(s);
13641364
return-1;
13651365
}
1366-
if ((handles[1]=socket(PF_INET,SOCK_STREAM,0))==INVALID_SOCKET)
1366+
if ((handles[1]=socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET)
13671367
{
13681368
write_msg(modulename,"pgpipe: could not create second socket: error code %d\n",
13691369
WSAGetLastError());

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp