From 46f033a3aeabbbd89c8657a0c811967f45f853fb Mon Sep 17 00:00:00 2001 From: benno Date: Mon, 18 Jul 2016 21:22:09 +0000 Subject: [PATCH] add format attributes to log functions and fix some errors ok claudio@ florian@ --- usr.sbin/sasyncd/net_ctl.c | 4 ++-- usr.sbin/sasyncd/pfkey.c | 8 ++++---- usr.sbin/sasyncd/sasyncd.h | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/usr.sbin/sasyncd/net_ctl.c b/usr.sbin/sasyncd/net_ctl.c index b8d3296a4b7..105b8938327 100644 --- a/usr.sbin/sasyncd/net_ctl.c +++ b/usr.sbin/sasyncd/net_ctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: net_ctl.c,v 1.10 2015/08/20 22:39:29 deraadt Exp $ */ +/* $OpenBSD: net_ctl.c,v 1.11 2016/07/18 21:22:09 benno Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -158,7 +158,7 @@ net_ctl_send(struct syncpeer *p, u_int32_t type, u_int32_t d, u_int32_t d2) struct ctlmsg *m = malloc(sizeof *m); if (!m) { - log_err("malloc(%u)", sizeof *m); + log_err("malloc(%zu)", sizeof *m); return -1; } diff --git a/usr.sbin/sasyncd/pfkey.c b/usr.sbin/sasyncd/pfkey.c index 7bc6d810270..6679973f096 100644 --- a/usr.sbin/sasyncd/pfkey.c +++ b/usr.sbin/sasyncd/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.25 2015/10/18 02:39:04 mmcc Exp $ */ +/* $OpenBSD: pfkey.c,v 1.26 2016/07/18 21:22:09 benno Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -424,7 +424,7 @@ pfkey_queue_message(u_int8_t *data, u_int32_t datalen) sadb->sadb_msg_pid = getpid(); sadb->sadb_msg_seq = seq++; - log_msg(2, "pfkey_queue_message: pfkey %s len %u seq %u", + log_msg(2, "pfkey_queue_message: pfkey %s len %zu seq %u", pfkey_print_type(sadb), sadb->sadb_msg_len * CHUNK, sadb->sadb_msg_seq); @@ -491,7 +491,7 @@ pfkey_snapshot(void *v) memcpy(sendbuf, m, m->sadb_msg_len * CHUNK); net_queue(p, MSG_PFKEYDATA, sendbuf, m->sadb_msg_len * CHUNK); - log_msg(2, "pfkey_snapshot: sync SA %p len %u " + log_msg(2, "pfkey_snapshot: sync SA %p len %zu " "to peer %s", m, m->sadb_msg_len * CHUNK, p->name); } @@ -522,7 +522,7 @@ pfkey_snapshot(void *v) net_queue(p, MSG_PFKEYDATA, sendbuf, m->sadb_msg_len * CHUNK); log_msg(2, "pfkey_snapshot: sync FLOW %p len " - "%u to peer %s", m, + "%zu to peer %s", m, m->sadb_msg_len * CHUNK, p->name); } } diff --git a/usr.sbin/sasyncd/sasyncd.h b/usr.sbin/sasyncd/sasyncd.h index 92f8ec6e013..4f2847ca3dd 100644 --- a/usr.sbin/sasyncd/sasyncd.h +++ b/usr.sbin/sasyncd/sasyncd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sasyncd.h,v 1.17 2012/09/15 00:46:43 guenther Exp $ */ +/* $OpenBSD: sasyncd.h,v 1.18 2016/07/18 21:22:09 benno Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -136,8 +136,10 @@ void control_setrun(void); * 6 = timers */ void log_init(char *); -void log_msg(int, const char *, ...); -void log_err(const char *, ...); +void log_msg(int, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); +void log_err(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); /* monitor.c */ pid_t monitor_init(void); -- 2.20.1