summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-02-15 10:03:52 +0100
committerPeter Eisentraut <peter@eisentraut.org>2022-02-15 10:16:34 +0100
commit797129e5910144a2a937b88e145874a15b83578a (patch)
tree7d19263d97ad759f3109ec427afff93cc763b03a /src/interfaces/libpq/fe-connect.c
parenta59135a81aa781d126c48a516179e43dbb0d428a (diff)
Remove IS_AF_UNIX macro
The AF_UNIX macro was being used unprotected by HAVE_UNIX_SOCKETS, apparently since 2008. So the redirection through IS_AF_UNIX() is apparently no longer necessary. (More generally, all supported platforms are now HAVE_UNIX_SOCKETS, but even if there were a new platform in the future, it seems plausible that it would define the AF_UNIX symbol even without kernel support.) So remove the IS_AF_UNIX() macro and make the code a bit more consistent. Discussion: https://www.postgresql.org/message-id/flat/f2d26815-9832-e333-d52d-72fbc0ade896%40enterprisedb.com
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index a6a1db3356d..30d6b7b3778 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -1694,7 +1694,7 @@ static void
emitHostIdentityInfo(PGconn *conn, const char *host_addr)
{
#ifdef HAVE_UNIX_SOCKETS
- if (IS_AF_UNIX(conn->raddr.addr.ss_family))
+ if (conn->raddr.addr.ss_family == AF_UNIX)
{
char service[NI_MAXHOST];
@@ -1758,7 +1758,7 @@ connectFailureMessage(PGconn *conn, int errorno)
SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)));
#ifdef HAVE_UNIX_SOCKETS
- if (IS_AF_UNIX(conn->raddr.addr.ss_family))
+ if (conn->raddr.addr.ss_family == AF_UNIX)
appendPQExpBufferStr(&conn->errorMessage,
libpq_gettext("\tIs the server running locally and accepting connections on that socket?\n"));
else
@@ -2590,7 +2590,7 @@ keep_going: /* We will come back to here until there is
* TCP sockets, nonblock mode, close-on-exec. Try the
* next address if any of this fails.
*/
- if (!IS_AF_UNIX(addr_cur->ai_family))
+ if (addr_cur->ai_family != AF_UNIX)
{
if (!connectNoDelay(conn))
{
@@ -2619,7 +2619,7 @@ keep_going: /* We will come back to here until there is
}
#endif /* F_SETFD */
- if (!IS_AF_UNIX(addr_cur->ai_family))
+ if (addr_cur->ai_family != AF_UNIX)
{
#ifndef WIN32
int on = 1;
@@ -2821,7 +2821,7 @@ keep_going: /* We will come back to here until there is
* Unix-domain socket.
*/
if (conn->requirepeer && conn->requirepeer[0] &&
- IS_AF_UNIX(conn->raddr.addr.ss_family))
+ conn->raddr.addr.ss_family == AF_UNIX)
{
#ifndef WIN32
char *remote_username;
@@ -2867,7 +2867,7 @@ keep_going: /* We will come back to here until there is
#endif /* WIN32 */
}
- if (IS_AF_UNIX(conn->raddr.addr.ss_family))
+ if (conn->raddr.addr.ss_family == AF_UNIX)
{
/* Don't request SSL or GSSAPI over Unix sockets */
#ifdef USE_SSL
@@ -4528,7 +4528,7 @@ PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
* This ensures that this function does not block indefinitely when
* reasonable keepalive and timeout settings have been provided.
*/
- if (!IS_AF_UNIX(cancel->raddr.addr.ss_family) &&
+ if (cancel->raddr.addr.ss_family != AF_UNIX &&
cancel->keepalives != 0)
{
#ifndef WIN32