Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Mar 2017 17:15:45 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315200 - head/sbin/dhclient/tests
Message-ID:  <201703131715.v2DHFja9054214@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Mar 13 17:15:45 2017
New Revision: 315200
URL: https://svnweb.freebsd.org/changeset/base/315200

Log:
  Fix -Wunused-but-set-warning with `ret`
  
  While here, resolve Coverity warnings by demonstrating that vfprintf's
  return value is being explicitly ignored.
  
  MFC after:	1 week
  Reported by:	gcc 6.3.0
  Tested with:	clang, gcc 4.2.1, gcc 6.3.0
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sbin/dhclient/tests/fake.c

Modified: head/sbin/dhclient/tests/fake.c
==============================================================================
--- head/sbin/dhclient/tests/fake.c	Mon Mar 13 17:05:49 2017	(r315199)
+++ head/sbin/dhclient/tests/fake.c	Mon Mar 13 17:15:45 2017	(r315200)
@@ -14,7 +14,7 @@ error(char *fmt, ...)
 	va_list ap;
 
 	va_start(ap, fmt);
-	vfprintf(stderr, fmt, ap);
+	(void)vfprintf(stderr, fmt, ap);
 	va_end(ap);
 	fprintf(stderr, "\n");
 
@@ -24,11 +24,10 @@ error(char *fmt, ...)
 int
 warning(char *fmt, ...)
 {
-	int ret;
 	va_list ap;
 
 	va_start(ap, fmt);
-	ret = vfprintf(stderr, fmt, ap);
+	(void)vfprintf(stderr, fmt, ap);
 	va_end(ap);
 	fprintf(stderr, "\n");
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703131715.v2DHFja9054214>