diff options
author | Tatsuo Ishii <ishii@postgresql.org> | 2000-12-22 07:59:32 +0000 |
---|---|---|
committer | Tatsuo Ishii <ishii@postgresql.org> | 2000-12-22 07:59:32 +0000 |
commit | 1deb6e7d414f21e4adecdcc496252b0c594852f2 (patch) | |
tree | ca3d83138fb42bfd23a3e24e93e8e09a8fb48885 | |
parent | 317215fc55ae9ead960b3e1e79aa41fd004f7414 (diff) | |
download | postgresql-1deb6e7d414f21e4adecdcc496252b0c594852f2.tar.gz postgresql-1deb6e7d414f21e4adecdcc496252b0c594852f2.zip |
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.
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 868b73f6f7c..0c6ff92bea6 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.155 2000/12/18 17:33:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.156 2000/12/22 07:59:32 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -438,7 +438,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, else if ((tmp = getenv("PGHOST")) != NULL) conn->pghost = strdup(tmp); - if (pgport == NULL) + if (pgport == NULL || pgport[0] == '\0') { if ((tmp = getenv("PGPORT")) == NULL) tmp = DEF_PGPORT_STR; |