Skip to content

Commit 4032a51

Browse files
committed
PGPORT envar was erroneously ignored by the backend
1 parent beb7f7f commit 4032a51

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

src/backend/libpq/pqcomm.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
3030
* Portions Copyright (c) 1994, Regents of the University of California
3131
*
32-
* $Id: pqcomm.c,v 1.95 2000/06/04 01:44:30 petere Exp $
32+
* $Id: pqcomm.c,v 1.96 2000/06/06 16:04:29 petere Exp $
3333
*
3434
*-------------------------------------------------------------------------
3535
*/
@@ -118,19 +118,6 @@ pq_init(void)
118118
debug_port = stderr;
119119
}
120120

121-
/* --------------------------------
122-
* pq_getport - return the PGPORT setting
123-
* --------------------------------
124-
*/
125-
int
126-
pq_getport(void)
127-
{
128-
char *envport = getenv("PGPORT");
129-
130-
if (envport)
131-
return atoi(envport);
132-
return DEF_PGPORT;
133-
}
134121

135122
/* --------------------------------
136123
* pq_close - shutdown libpq at backend exit

src/backend/postmaster/postmaster.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.146 2000/06/04 01:44:31 petere Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.147 2000/06/06 16:04:29 petere Exp $
1515
*
1616
* NOTES
1717
*
@@ -129,7 +129,7 @@ static Dllist *BackendList;
129129
/* list of ports associated with still open, but incomplete connections */
130130
static Dllist *PortList;
131131

132-
int PostPortName = DEF_PGPORT;
132+
int PostPortName;
133133

134134
/*
135135
* This is a boolean indicating that there is at least one backend that
@@ -381,6 +381,9 @@ PostmasterMain(int argc, char *argv[])
381381
MyProcPid = getpid();
382382
DataDir = getenv("PGDATA"); /* default value */
383383

384+
if (getenv("PGPORT"))
385+
PostPortName = atoi(getenv("PGPORT"));
386+
384387
/*
385388
* First we must scan for a -D argument to get the data dir. Then
386389
* read the config file. Finally, scan all the other arguments.
@@ -543,9 +546,6 @@ PostmasterMain(int argc, char *argv[])
543546
}
544547
}
545548

546-
if (PostPortName == 0)
547-
PostPortName = pq_getport();
548-
549549
/*
550550
* Check for invalid combinations of switches
551551
*/

src/include/libpq/libpq.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: libpq.h,v 1.37 2000/06/04 01:44:37 petere Exp $
10+
* $Id: libpq.h,v 1.38 2000/06/06 16:04:32 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -240,7 +240,6 @@ extern int StreamServerPort(int family, unsigned short portName, int *fdP);
240240
extern int StreamConnection(int server_fd, Port *port);
241241
extern void StreamClose(int sock);
242242
extern void pq_init(void);
243-
extern int pq_getport(void);
244243
extern void pq_close(void);
245244
extern int pq_getbytes(char *s, size_t len);
246245
extern int pq_getstring(StringInfo s);

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