Skip to content

Commit 1deb6e7

Browse files
committed
Fix PQsetdbLogin() backward compatibility problem.
If pghost == "" and pgport == "" then PQsetdbLogin() fails with a error message: Is the postmaster running locally and accepting connections on Unix socket '/tmp/.s.PGSQL.0'? I see many applications such as PHP fails due to this behavior. Now if pgport == "", then it is assumed to be a DEF_PGPORT_STR. This is the same behavior as the version prior 7.1.
1 parent 317215f commit 1deb6e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.155 2000/12/18 17:33:41 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.156 2000/12/22 07:59:32 ishii Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -438,7 +438,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
438438
else if ((tmp = getenv("PGHOST")) != NULL)
439439
conn->pghost = strdup(tmp);
440440

441-
if (pgport == NULL)
441+
if (pgport == NULL || pgport[0] == '\0')
442442
{
443443
if ((tmp = getenv("PGPORT")) == NULL)
444444
tmp = DEF_PGPORT_STR;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy