From: benno Date: Mon, 18 Jul 2016 21:10:37 +0000 (+0000) Subject: add format attributes to log functions and fix am error when using X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a8e259445fb1e751c91754b788ca95bd630bc5cd;p=openbsd add format attributes to log functions and fix am error when using log_warnx() ok renato@ claudio@ --- diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c index c9f2daf54c2..a21f11c4bd1 100644 --- a/usr.sbin/ldpd/lde.c +++ b/usr.sbin/ldpd/lde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lde.c,v 1.61 2016/07/01 23:36:38 renato Exp $ */ +/* $OpenBSD: lde.c,v 1.62 2016/07/18 21:10:37 benno Exp $ */ /* * Copyright (c) 2013, 2016 Renato Westphal @@ -1134,7 +1134,7 @@ lde_req_add(struct lde_nbr *ln, struct fec *fec, int sent) lre->fec = *fec; if (fec_insert(t, &lre->fec)) { - log_warnx("failed to add %s/%u to %s req", + log_warnx("failed to add %s to %s req", log_fec(&lre->fec), sent ? "sent" : "recv"); free(lre); return (NULL); diff --git a/usr.sbin/ldpd/log.h b/usr.sbin/ldpd/log.h index 9d42fa6606e..f7948a3b254 100644 --- a/usr.sbin/ldpd/log.h +++ b/usr.sbin/ldpd/log.h @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.13 2016/07/15 17:09:25 renato Exp $ */ +/* $OpenBSD: log.h,v 1.14 2016/07/18 21:10:37 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -28,13 +28,20 @@ struct fec; void log_init(int); void log_verbose(int); -void logit(int, const char *, ...); -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 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 *log_sockaddr(void *); const char *log_in6addr(const struct in6_addr *); const char *log_in6addr_scope(const struct in6_addr *, unsigned int);