summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2008-12-04 17:24:14 +0000
committerChad Loder <cloder@cvs.openbsd.org>2008-12-04 17:24:14 +0000
commit869cd4e4d1d916b0ed1bbf8f386d3302c69e46d7 (patch)
treedbeab30c0b440c3e027b9ea8d84dcfd93b33905b /usr.sbin/smtpd
parent4417df738b65cdcfb5fcc5c2e46cf477a204c38a (diff)
Declare printf-style functions with __attribute__((format(printf,x,x)))
and fix some of the errors caught by this. Part of a general push to make yyerror() -Wformat clean throughout the tree.
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/imsg.c6
-rw-r--r--usr.sbin/smtpd/log.c6
-rw-r--r--usr.sbin/smtpd/parse.y13
-rw-r--r--usr.sbin/smtpd/smtpd.h14
4 files changed, 23 insertions, 16 deletions
diff --git a/usr.sbin/smtpd/imsg.c b/usr.sbin/smtpd/imsg.c
index 00665191dca..bf32c79cde6 100644
--- a/usr.sbin/smtpd/imsg.c
+++ b/usr.sbin/smtpd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.1 2008/11/01 21:35:28 gilles Exp $ */
+/* $OpenBSD: imsg.c,v 1.2 2008/12/04 17:24:13 cloder Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -202,8 +202,8 @@ imsg_create(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
datalen += IMSG_HEADER_SIZE;
if (datalen > MAX_IMSGSIZE) {
- log_warnx("imsg_create: len %u > MAX_IMSGSIZE; "
- "type %u peerid %lu", datalen + IMSG_HEADER_SIZE,
+ log_warnx("imsg_create: len %zu > MAX_IMSGSIZE; "
+ "type %u peerid %u", datalen + IMSG_HEADER_SIZE,
type, peerid);
return (NULL);
}
diff --git a/usr.sbin/smtpd/log.c b/usr.sbin/smtpd/log.c
index f7956810a2a..ffdcb574ad7 100644
--- a/usr.sbin/smtpd/log.c
+++ b/usr.sbin/smtpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.2 2008/11/17 21:56:18 chl Exp $ */
+/* $OpenBSD: log.c,v 1.3 2008/12/04 17:24:13 cloder Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -38,7 +38,9 @@
int debug;
void vlog(int, const char *, va_list);
-void logit(int, const char *, ...);
+void logit(int, const char *, ...)
+ __attribute__ ((format (printf, 2, 3)));
+
void
log_init(int n_debug)
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index 923a1bd5f8c..9767263804d 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.12 2008/12/04 00:10:15 ian Exp $ */
+/* $OpenBSD: parse.y,v 1.13 2008/12/04 17:24:13 cloder Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -61,12 +61,13 @@ int popfile(void);
int check_file_secrecy(int, const char *);
int yyparse(void);
int yylex(void);
-int yyerror(const char *, ...);
int kw_cmp(const void *, const void *);
int lookup(char *);
int lgetc(int);
int lungetc(int);
int findeol(void);
+int yyerror(const char *, ...)
+ __attribute__ ((format (printf, 1, 2)));
TAILQ_HEAD(symhead, sym) symhead = TAILQ_HEAD_INITIALIZER(symhead);
struct sym {
@@ -178,7 +179,7 @@ quantifier : /* empty */ { $$ = 1; }
interval : NUMBER quantifier {
if ($1 < 0) {
- yyerror("invalid interval: %d\n", $1);
+ yyerror("invalid interval: %lld", $1);
YYERROR;
}
$$.tv_usec = 0;
@@ -199,7 +200,7 @@ port : PORT STRING {
}
| PORT NUMBER {
if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
- yyerror("invalid port: %d", $2);
+ yyerror("invalid port: %lld", $2);
YYERROR;
}
$$ = htons($2);
@@ -337,7 +338,7 @@ map : MAP STRING {
map = m;
} '{' optnl mapopts_l '}' {
if (map->m_src == S_NONE) {
- yyerror("map %s has no source defined");
+ yyerror("map %s has no source defined", $2);
free(map);
map = NULL;
YYERROR;
@@ -574,7 +575,7 @@ mapref : STRING {
struct map *m;
if ((m = map_findbyname(conf, $2)) == NULL) {
- yyerror("no such map: %s");
+ yyerror("no such map: %s", $2);
free($2);
YYERROR;
}
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index e9656702fd0..62710a22d7a 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.18 2008/12/04 01:16:14 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.19 2008/12/04 17:24:13 cloder Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -649,10 +649,14 @@ int aliases_virtual_get(struct smtpd *, struct aliaseslist *, struct path *);
/* log.c */
void log_init(int);
-void log_warn(const char *, ...);
-void log_warnx(const char *, ...);
-void log_info(const char *, ...);
-void log_debug(const char *, ...);
+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)));
__dead void fatal(const char *);
__dead void fatalx(const char *);