mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
On further thought, we need a defense against empty PGPORT here too.
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.157 2000/12/31 18:15:58 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.158 2000/12/31 18:23:21 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -861,7 +861,11 @@ connectDBStart(PGconn *conn)
|
|||||||
conn->raddr.sa.sa_family = family;
|
conn->raddr.sa.sa_family = family;
|
||||||
|
|
||||||
/* Set port number */
|
/* Set port number */
|
||||||
portno = atoi(conn->pgport);
|
if (conn->pgport != NULL && conn->pgport[0] != '\0')
|
||||||
|
portno = atoi(conn->pgport);
|
||||||
|
else
|
||||||
|
portno = DEF_PGPORT;
|
||||||
|
|
||||||
if (family == AF_INET)
|
if (family == AF_INET)
|
||||||
{
|
{
|
||||||
conn->raddr.in.sin_port = htons((unsigned short) (portno));
|
conn->raddr.in.sin_port = htons((unsigned short) (portno));
|
||||||
@ -875,7 +879,6 @@ connectDBStart(PGconn *conn)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Open a socket */
|
/* Open a socket */
|
||||||
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
|
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user