mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Fix startup so that log prefix %h works for the log_connections message.
We entirely randomly chose to initialize port->remote_host just after printing the log_connections message, when we could perfectly well do it just before, allowing %h and %r to work for that message. Per gripe from Artem Tomyuk.
This commit is contained in:
parent
e8267aba5f
commit
2acb682f68
@ -4068,6 +4068,14 @@ BackendInitialize(Port *port)
|
|||||||
else
|
else
|
||||||
snprintf(remote_ps_data, sizeof(remote_ps_data), "%s(%s)", remote_host, remote_port);
|
snprintf(remote_ps_data, sizeof(remote_ps_data), "%s(%s)", remote_host, remote_port);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save remote_host and remote_port in port structure (after this, they
|
||||||
|
* will appear in log_line_prefix data for log messages).
|
||||||
|
*/
|
||||||
|
port->remote_host = strdup(remote_host);
|
||||||
|
port->remote_port = strdup(remote_port);
|
||||||
|
|
||||||
|
/* And now we can issue the Log_connections message, if wanted */
|
||||||
if (Log_connections)
|
if (Log_connections)
|
||||||
{
|
{
|
||||||
if (remote_port[0])
|
if (remote_port[0])
|
||||||
@ -4081,12 +4089,6 @@ BackendInitialize(Port *port)
|
|||||||
remote_host)));
|
remote_host)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* save remote_host and remote_port in port structure
|
|
||||||
*/
|
|
||||||
port->remote_host = strdup(remote_host);
|
|
||||||
port->remote_port = strdup(remote_port);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we did a reverse lookup to name, we might as well save the results
|
* If we did a reverse lookup to name, we might as well save the results
|
||||||
* rather than possibly repeating the lookup during authentication.
|
* rather than possibly repeating the lookup during authentication.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user