diff options
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 5 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-int.h | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 9c51166b40a..4a1a0272b6b 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -5353,7 +5353,10 @@ PQhost(const PGconn *conn) else { #ifdef HAVE_UNIX_SOCKETS - return conn->pgunixsocket; + if (conn->pgunixsocket != NULL && conn->pgunixsocket[0] != '\0') + return conn->pgunixsocket; + else + return DEFAULT_PGSOCKET_DIR; #else return DefaultHost; #endif diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 4b69c1216db..98ea6b19477 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -302,10 +302,9 @@ struct pg_conn char *pghostaddr; /* the numeric IP address of the machine on * which the server is running. Takes * precedence over above. */ - char *pgport; /* the server's communication port */ - char *pgunixsocket; /* the Unix-domain socket that the server is - * listening on; if NULL, uses a default - * constructed from pgport */ + char *pgport; /* the server's communication port number */ + char *pgunixsocket; /* the directory of the server's Unix-domain + * socket; if NULL, use DEFAULT_PGSOCKET_DIR */ char *pgtty; /* tty on which the backend messages is * displayed (OBSOLETE, NOT USED) */ char *connect_timeout; /* connection timeout (numeric string) */ |