Re: postmaster.c ,have a warning: pg_getnameinfo_all() failed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "zhaozp(at)uxsino(dot)com" <zhaozp(at)uxsino(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: postmaster.c ,have a warning: pg_getnameinfo_all() failed
Date: 2017-03-14 14:25:37
Message-ID: 28845.1489501537@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"zhaozp(at)uxsino(dot)com" <zhaozp(at)uxsino(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Anastasia Lubennikova 2017-03-14 15:27:14 Re: Backend crash on non-exclusive backup cancel
Previous Message zhaozp@uxsino.com 2017-03-14 05:53:53 postmaster.c ,have a warning: pg_getnameinfo_all() failed