freebsd-dev/sbin/dhclient/tests/fake.c
Enji Cooper 513bdaa141 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
2017-03-13 17:15:45 +00:00

64 lines
773 B
C

/* $FreeBSD$ */
#include <setjmp.h>
#include <stdarg.h>
#include <stdio.h>
#include "dhcpd.h"
extern jmp_buf env;
void
error(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
longjmp(env, 1);
}
int
warning(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
/*
* The original warning() would return "ret" here. We do this to
* check warnings explicitely.
*/
longjmp(env, 1);
}
int
note(char *fmt, ...)
{
int ret;
va_list ap;
va_start(ap, fmt);
ret = vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
return ret;
}
void
bootp(struct packet *packet)
{
}
void
dhcp(struct packet *packet)
{
}