AF_UNSPEC vs PF_UNSPEC

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Cc: Marco Atzeri <marco(dot)atzeri(at)gmail(dot)com>
Subject: AF_UNSPEC vs PF_UNSPEC
Date: 2014-04-16 16:26:23
Message-ID: 28023.1397665583@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While wondering what the heck is going on in
http://www.postgresql.org/message-id/534E8FBB.9060006@gmail.com
I chanced to notice that pgstat.c and a couple of other places set
up arguments for getaddrinfo() like this:

hints.ai_family = PF_UNSPEC;

whereas the Single Unix Spec says clearly that AF_UNSPEC is what
to write if you're not intending to constrain the address family.
AF_UNSPEC is what we use in the majority of places, too.

On Linux, at least, these symbols have the same value so it doesn't
matter; but I wonder whether they are different on recent Cygwin.

Anyway, I think this is clearly wrong and we should change it.
I see a "PF_INET" that presumably ought to be "AF_INET" in
pg_dump/parallel.c, too.

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-04-16 16:28:37 Re: bgworker crashed or not?
Previous Message Robert Haas 2014-04-16 16:25:20 Re: Dynamic Background Workers and clean exit