From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] cmdline: fix warning for unused return value Date: Thu, 7 Sep 2017 10:50:20 -0700 Message-ID: <20170907105020.62f8eb79@xeon-e3> References: <20170907130923.157924-1-bruce.richardson@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Bruce Richardson Return-path: Received: from mail-pg0-f47.google.com (mail-pg0-f47.google.com [74.125.83.47]) by dpdk.org (Postfix) with ESMTP id 22A182BFE for ; Thu, 7 Sep 2017 19:50:29 +0200 (CEST) Received: by mail-pg0-f47.google.com with SMTP id d8so731484pgt.4 for ; Thu, 07 Sep 2017 10:50:29 -0700 (PDT) In-Reply-To: <20170907130923.157924-1-bruce.richardson@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 7 Sep 2017 14:09:23 +0100 Bruce Richardson wrote: > When DPDK is compiled on Ubuntu with extra warnings turned on, there is a > warning about the return value from write() being unchecked. Rather than > having builds disable the warning, which may mask other cases we do care > about, we can add a dummy use of the return value in the code to silence it > in this instance. > > Signed-off-by: Bruce Richardson > --- > lib/librte_cmdline/cmdline.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c > index a9c47be..d749165 100644 > --- a/lib/librte_cmdline/cmdline.c > +++ b/lib/librte_cmdline/cmdline.c > @@ -205,7 +205,8 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...) > } > if (ret >= BUFSIZ) > ret = BUFSIZ - 1; > - write(cl->s_out, buf, ret); > + ret = write(cl->s_out, buf, ret); > + (void)ret; That is an ugly way to fix the warning. If write fails, the user has probably logged out.