Skip to content

Commit e41b8a0

Browse files
committed
On further thought, we need a defense against empty PGPORT here too.
1 parent 45f9217 commit e41b8a0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 6 additions & 3 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.157 2000/12/31 18:15:58 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.158 2000/12/31 18:23:21 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -861,7 +861,11 @@ connectDBStart(PGconn *conn)
861861
conn->raddr.sa.sa_family = family;
862862

863863
/* Set port number */
864-
portno = atoi(conn->pgport);
864+
if (conn->pgport != NULL && conn->pgport[0] != '\0')
865+
portno = atoi(conn->pgport);
866+
else
867+
portno = DEF_PGPORT;
868+
865869
if (family == AF_INET)
866870
{
867871
conn->raddr.in.sin_port = htons((unsigned short) (portno));
@@ -875,7 +879,6 @@ connectDBStart(PGconn *conn)
875879
}
876880
#endif
877881

878-
879882
/* Open a socket */
880883
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
881884
{

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