svn commit: r315200 - head/sbin/dhclient/tests

Ngie Cooper ngie at FreeBSD.org
Mon Mar 13 17:15:46 UTC 2017


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");
 


More information about the svn-src-head mailing list