From: benno Date: Mon, 18 Jul 2016 21:20:31 +0000 (+0000) Subject: add format attributes to log functions X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f3706e345c7ee93eab580c30576cf4747bcafe87;p=openbsd add format attributes to log functions ok florian@ claudio@ --- diff --git a/usr.sbin/ripd/log.h b/usr.sbin/ripd/log.h index d2961e252ac..98707c1fc8d 100644 --- a/usr.sbin/ripd/log.h +++ b/usr.sbin/ripd/log.h @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.3 2014/11/03 20:15:31 bluhm Exp $ */ +/* $OpenBSD: log.h,v 1.4 2016/07/18 21:20:31 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -23,14 +23,22 @@ void log_init(int); void log_verbose(int); -void logit(int, const char *, ...); -void vlog(int, const char *, va_list); -void log_warn(const char *, ...); -void log_warnx(const char *, ...); -void log_info(const char *, ...); -void log_debug(const char *, ...); -void fatal(const char *) __dead; -void fatalx(const char *) __dead; +void logit(int, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); +void vlog(int, const char *, va_list) + __attribute__((__format__ (printf, 2, 0))); +void log_warn(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void log_warnx(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void log_info(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void log_debug(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); +void fatal(const char *) __dead + __attribute__((__format__ (printf, 1, 0))); +void fatalx(const char *) __dead + __attribute__((__format__ (printf, 1, 0))); const char *if_type_name(enum iface_type); const char *nbr_state_name(int); diff --git a/usr.sbin/ripd/neighbor.c b/usr.sbin/ripd/neighbor.c index cedb527b727..29f5b893519 100644 --- a/usr.sbin/ripd/neighbor.c +++ b/usr.sbin/ripd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.9 2007/10/24 19:50:33 claudio Exp $ */ +/* $OpenBSD: neighbor.c,v 1.10 2016/07/18 21:20:31 benno Exp $ */ /* * Copyright (c) 2006 Michele Marchetto @@ -196,7 +196,7 @@ nbr_new(u_int32_t nbr_id, struct iface *iface) /* set event structures */ evtimer_set(&nbr->timeout_timer, nbr_timeout_timer, nbr); - log_debug("nbr_new: neighbor ID %s, peerid %lu", + log_debug("nbr_new: neighbor ID %s, peerid %u", inet_ntoa(nbr->id), nbr->peerid); return (nbr); @@ -211,7 +211,7 @@ nbr_act_del(struct nbr *nbr) nbr->state != NBR_STA_REQ_RCVD) nbr_failed_new(nbr); - log_debug("nbr_del: neighbor ID %s, peerid %lu", inet_ntoa(nbr->id), + log_debug("nbr_del: neighbor ID %s, peerid %u", inet_ntoa(nbr->id), nbr->peerid); /* stop timer */