Skip to content

Commit a3b9c69

Browse files
committed
Suppress port number for unix domain sockets in log connect/disconnect
messages.
1 parent d7bb412 commit a3b9c69

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.467 2005/08/20 23:26:17 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.468 2005/09/22 15:33:35 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -2701,8 +2701,9 @@ BackendRun(Port *port)
27012701

27022702
if (Log_connections)
27032703
ereport(LOG,
2704-
(errmsg("connection received: host=%s port=%s",
2705-
remote_host, remote_port)));
2704+
(errmsg("connection received: host=%s%s%s",
2705+
remote_host, remote_port[0] ? " port=" : "",
2706+
remote_port)));
27062707

27072708
/*
27082709
* save remote_host and remote_port in port stucture

src/backend/tcop/postgres.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.460 2005/09/19 17:21:47 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.461 2005/09/22 15:33:36 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -3525,9 +3525,11 @@ log_disconnections(int code, Datum arg)
35253525
snprintf(dbname, sizeof(dbname), " database=%s", port->database_name);
35263526
snprintf(remote_host, sizeof(remote_host), " host=%s",
35273527
port->remote_host);
3528-
snprintf(remote_port, sizeof(remote_port), " port=%s", port->remote_port);
3529-
3530-
3528+
if (port->remote_port[0])
3529+
snprintf(remote_port, sizeof(remote_port), " port=%s", port->remote_port);
3530+
else
3531+
remote_port[0] = '\0';
3532+
35313533
gettimeofday(&end, NULL);
35323534

35333535
if (end.tv_usec < port->session_start.tv_usec)

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