From ceeebefe3564938ff6ba87e7f465f6c35aeb8b03 Mon Sep 17 00:00:00 2001 From: benno Date: Wed, 28 Jul 2021 19:39:50 +0000 Subject: [PATCH] add format attribute to vaararg functions. millert@ thinks its useful. --- usr.sbin/smtpd/bounce.c | 8 +++++--- usr.sbin/smtpd/enqueue.c | 5 +++-- usr.sbin/smtpd/iobuf.h | 5 +++-- usr.sbin/smtpd/ioev.h | 5 +++-- usr.sbin/smtpd/mta_session.c | 8 +++++--- usr.sbin/smtpd/smtpd.h | 5 +++-- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c index b23a0dd4c78..5d0dad68698 100644 --- a/usr.sbin/smtpd/bounce.c +++ b/usr.sbin/smtpd/bounce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bounce.c,v 1.85 2021/06/14 17:58:15 eric Exp $ */ +/* $OpenBSD: bounce.c,v 1.86 2021/07/28 19:39:50 benno Exp $ */ /* * Copyright (c) 2009 Gilles Chehade @@ -78,11 +78,13 @@ SPLAY_PROTOTYPE(bounce_message_tree, bounce_message, sp_entry, bounce_message_cmp); static void bounce_drain(void); -static void bounce_send(struct bounce_session *, const char *, ...); +static void bounce_send(struct bounce_session *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); static int bounce_next_message(struct bounce_session *); static int bounce_next(struct bounce_session *); static void bounce_delivery(struct bounce_message *, int, const char *); -static void bounce_status(struct bounce_session *, const char *, ...); +static void bounce_status(struct bounce_session *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); static void bounce_io(struct io *, int, void *); static void bounce_timeout(int, short, void *); static void bounce_free(struct bounce_session *); diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index edabfc96505..c90b60d2bb3 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.119 2021/06/14 17:58:15 eric Exp $ */ +/* $OpenBSD: enqueue.c,v 1.120 2021/07/28 19:39:50 benno Exp $ */ /* * Copyright (c) 2005 Henning Brauer @@ -39,7 +39,8 @@ static char *qualify_addr(char *); static void rcpt_add(char *); static int open_connection(void); static int get_responses(FILE *, int); -static int send_line(FILE *, int, char *, ...); +static int send_line(FILE *, int, char *, ...) + __attribute__((__format__ (printf, 3, 4))); static int enqueue_offline(int, char *[], FILE *, FILE *); static int savedeadletter(struct passwd *, FILE *); diff --git a/usr.sbin/smtpd/iobuf.h b/usr.sbin/smtpd/iobuf.h index 94f5c56ecc2..1dc2fcb958d 100644 --- a/usr.sbin/smtpd/iobuf.h +++ b/usr.sbin/smtpd/iobuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iobuf.h,v 1.6 2021/03/05 12:37:32 eric Exp $ */ +/* $OpenBSD: iobuf.h,v 1.7 2021/07/28 19:39:50 benno Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -60,7 +60,8 @@ size_t iobuf_queued(struct iobuf *); void* iobuf_reserve(struct iobuf *, size_t); int iobuf_queue(struct iobuf *, const void*, size_t); int iobuf_queuev(struct iobuf *, const struct iovec *, int); -int iobuf_fqueue(struct iobuf *, const char *, ...); +int iobuf_fqueue(struct iobuf *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); int iobuf_vfqueue(struct iobuf *, const char *, va_list); int iobuf_flush(struct iobuf *, int); int iobuf_flush_tls(struct iobuf *, struct tls *); diff --git a/usr.sbin/smtpd/ioev.h b/usr.sbin/smtpd/ioev.h index 96b9e5c44e2..a6e725c22ba 100644 --- a/usr.sbin/smtpd/ioev.h +++ b/usr.sbin/smtpd/ioev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ioev.h,v 1.19 2021/03/05 12:37:32 eric Exp $ */ +/* $OpenBSD: ioev.h,v 1.20 2021/07/28 19:39:50 benno Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -61,7 +61,8 @@ int io_writev(struct io *, const struct iovec *, int); int io_print(struct io *, const char *); int io_printf(struct io *, const char *, ...) __attribute__((__format__ (printf, 2, 3))); -int io_vprintf(struct io *, const char *, va_list); +int io_vprintf(struct io *, const char *, va_list) + __attribute__((__format__ (printf, 2, 0))); size_t io_queued(struct io *); /* Buffered input functions */ diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index 2d83084b9e8..78e349019e7 100644 --- a/usr.sbin/smtpd/mta_session.c +++ b/usr.sbin/smtpd/mta_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta_session.c,v 1.143 2021/06/14 17:58:15 eric Exp $ */ +/* $OpenBSD: mta_session.c,v 1.144 2021/07/28 19:39:50 benno Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -131,8 +131,10 @@ static void mta_on_timeout(struct runq *, void *); static void mta_connect(struct mta_session *); static void mta_enter_state(struct mta_session *, int); static void mta_flush_task(struct mta_session *, int, const char *, size_t, int); -static void mta_error(struct mta_session *, const char *, ...); -static void mta_send(struct mta_session *, char *, ...); +static void mta_error(struct mta_session *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); +static void mta_send(struct mta_session *, char *, ...) + __attribute__((__format__ (printf, 2, 3))); static ssize_t mta_queue_data(struct mta_session *); static void mta_response(struct mta_session *, char *); static const char * mta_strstate(int); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index c2c65136b59..40028a0d864 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.669 2021/06/14 17:58:16 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.670 2021/07/28 19:39:51 benno Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -1322,7 +1322,8 @@ int enqueue(int, char **, FILE *); /* envelope.c */ -void envelope_set_errormsg(struct envelope *, char *, ...); +void envelope_set_errormsg(struct envelope *, char *, ...) + __attribute__((__format__ (printf, 2, 3))); void envelope_set_esc_class(struct envelope *, enum enhanced_status_class); void envelope_set_esc_code(struct envelope *, enum enhanced_status_code); int envelope_load_buffer(struct envelope *, const char *, size_t); -- 2.20.1