pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedpostmaster.c ,have a warning: pg_getnameinfo_all() failed
2+ messages / 2 participants
[nested] [flat]
* postmaster.c ,have a warning: pg_getnameinfo_all() failed
@ 2017-03-14 05:53 zhaozp@uxsino.com <zhaozp@uxsino.com>
2017-03-14 14:25 ` Re: postmaster.c ,have a warning: pg_getnameinfo_all() failed Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: zhaozp@uxsino.com @ 2017-03-14 05:53 UTC (permalink / raw)
To: pgsql-bugs
static void
4071 BackendInitialize(Port *port)
4072 {
4073 int status;
4074 int ret;
4075 char remote_host[NI_MAXHOST];
4076 char remote_port[NI_MAXSERV];
4077 char remote_ps_data[NI_MAXHOST];
4078
4129
4130 /*
4131 * Get the remote host name and port for logging and status display.
4132 */
4133 remote_host[0] = '\0';
4134 remote_port[0] = '\0';
4135 if ((ret = pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen,
4136 remote_host, sizeof(remote_host),
4137 remote_port, sizeof(remote_port),
4138 (log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV)) != 0)
4139 ereport(WARNING,
4140 (errmsg_internal("pg_getnameinfo_all() failed: %s",
4141 gai_strerror(ret))));
Modified below, correct?
4136 remote_host, NI_MAXHOST,
4137 remote_port, NI_MAXSERV,
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: postmaster.c ,have a warning: pg_getnameinfo_all() failed
2017-03-14 05:53 postmaster.c ,have a warning: pg_getnameinfo_all() failed zhaozp@uxsino.com <zhaozp@uxsino.com>
@ 2017-03-14 14:25 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2017-03-14 14:25 UTC (permalink / raw)
To: zhaozp@uxsino.com <zhaozp@uxsino.com>; +Cc: pgsql-bugs
"zhaozp@uxsino.com" <zhaozp@uxsino.com> writes:
> 4075 char remote_host[NI_MAXHOST];
> 4076 char remote_port[NI_MAXSERV];
> ...
> 4135 if ((ret = pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen,
> 4136 remote_host, sizeof(remote_host),
> 4137 remote_port, sizeof(remote_port),
> 4138 (log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV)) != 0)
> Modified below, correct?
> 4136 remote_host, NI_MAXHOST,
> 4137 remote_port, NI_MAXSERV,
Why do you think that's an improvement? The values should be the same,
but the existing code doesn't have a hazard of changing the array size
in one place and failing to change the other.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-03-14 14:25 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14 05:53 postmaster.c ,have a warning: pg_getnameinfo_all() failed zhaozp@uxsino.com <zhaozp@uxsino.com>
2017-03-14 14:25 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox