Add format string checks for _warn_helper.

This commit is contained in:
joerg 2014-01-07 02:09:01 +00:00
parent a97560b644
commit 4875b4da16
2 changed files with 5 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: log-internal.h,v 1.2 2013/04/11 16:56:41 christos Exp $ */ /* $NetBSD: log-internal.h,v 1.3 2014/01/07 02:09:01 joerg Exp $ */
/* /*
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
@ -31,7 +31,7 @@
#include "event2/util.h" #include "event2/util.h"
#ifdef __GNUC__ #ifdef __GNUC__
#define EV_CHECK_FMT(a,b) __attribute__((format(printf, a, b))) #define EV_CHECK_FMT(a,b) __attribute__((__format__(__printf__, a, b)))
#define EV_NORETURN __attribute__((noreturn)) #define EV_NORETURN __attribute__((noreturn))
#else #else
#define EV_CHECK_FMT(a,b) #define EV_CHECK_FMT(a,b)
@ -55,6 +55,4 @@ void _event_debugx(const char *fmt, ...) EV_CHECK_FMT(1,2);
#define event_debug(x) do {;} while (/*CONSTCOND*/0) #define event_debug(x) do {;} while (/*CONSTCOND*/0)
#endif #endif
#undef EV_CHECK_FMT
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: log.c,v 1.1.1.2 2013/04/11 16:43:26 christos Exp $ */ /* $NetBSD: log.c,v 1.2 2014/01/07 02:09:01 joerg Exp $ */
/* $OpenBSD: err.c,v 1.2 2002/06/25 15:50:15 mickey Exp $ */ /* $OpenBSD: err.c,v 1.2 2002/06/25 15:50:15 mickey Exp $ */
/* /*
@ -40,7 +40,7 @@
#include "event2/event-config.h" #include "event2/event-config.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: log.c,v 1.1.1.2 2013/04/11 16:43:26 christos Exp $"); __RCSID("$NetBSD: log.c,v 1.2 2014/01/07 02:09:01 joerg Exp $");
#ifdef WIN32 #ifdef WIN32
#include <winsock2.h> #include <winsock2.h>
@ -60,7 +60,7 @@ __RCSID("$NetBSD: log.c,v 1.1.1.2 2013/04/11 16:43:26 christos Exp $");
#include "log-internal.h" #include "log-internal.h"
static void _warn_helper(int severity, const char *errstr, const char *fmt, static void _warn_helper(int severity, const char *errstr, const char *fmt,
va_list ap); va_list ap) EV_CHECK_FMT(3, 0);
static void event_log(int severity, const char *msg); static void event_log(int severity, const char *msg);
static void event_exit(int errcode) EV_NORETURN; static void event_exit(int errcode) EV_NORETURN;