pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: zhaozp@uxsino.com <zhaozp@uxsino.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: postmaster.c ,have a warning: pg_getnameinfo_all() failed
Date: Tue, 14 Mar 2017 10:25:37 -0400
Message-ID: <28845.1489501537@sss.pgh.pa.us> (raw)
In-Reply-To: <201703141352529603355@uxsino.com>
References: <20160418093244.22924.55715@wrigleys.postgresql.org>
	<201703141352529603355@uxsino.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (2+ messages)

Message-ID: <28845.1489501537@sss.pgh.pa.us>
Permalink:  ../28845.1489501537@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28845.1489501537@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, zhaozp@uxsino.com
  Subject: Re: postmaster.c ,have a warning: pg_getnameinfo_all() failed
  In-Reply-To: <28845.1489501537@sss.pgh.pa.us>
  References: <20160418093244.22924.55715@wrigleys.postgresql.org> <201703141352529603355@uxsino.com> <28845.1489501537@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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