1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-05 23:56:58 +03:00

Suppress port number for unix domain sockets in log connect/disconnect

messages.
This commit is contained in:
Bruce Momjian 2005-09-22 15:33:36 +00:00
parent d7bb412e9c
commit a3b9c6988d
2 changed files with 10 additions and 7 deletions

View File

@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.467 2005/08/20 23:26:17 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.468 2005/09/22 15:33:35 momjian Exp $
* *
* NOTES * NOTES
* *
@ -2701,8 +2701,9 @@ BackendRun(Port *port)
if (Log_connections) if (Log_connections)
ereport(LOG, ereport(LOG,
(errmsg("connection received: host=%s port=%s", (errmsg("connection received: host=%s%s%s",
remote_host, remote_port))); remote_host, remote_port[0] ? " port=" : "",
remote_port)));
/* /*
* save remote_host and remote_port in port stucture * save remote_host and remote_port in port stucture

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.460 2005/09/19 17:21:47 momjian Exp $ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.461 2005/09/22 15:33:36 momjian Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
@ -3525,9 +3525,11 @@ log_disconnections(int code, Datum arg)
snprintf(dbname, sizeof(dbname), " database=%s", port->database_name); snprintf(dbname, sizeof(dbname), " database=%s", port->database_name);
snprintf(remote_host, sizeof(remote_host), " host=%s", snprintf(remote_host, sizeof(remote_host), " host=%s",
port->remote_host); port->remote_host);
snprintf(remote_port, sizeof(remote_port), " port=%s", port->remote_port); if (port->remote_port[0])
snprintf(remote_port, sizeof(remote_port), " port=%s", port->remote_port);
else
remote_port[0] = '\0';
gettimeofday(&end, NULL); gettimeofday(&end, NULL);
if (end.tv_usec < port->session_start.tv_usec) if (end.tv_usec < port->session_start.tv_usec)