summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2014-04-19 17:27:41 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2014-04-19 17:27:41 +0000
commit451b0ee35d4f502a0014df304cedc6015003d73c (patch)
treec32e0f52f6bd1b0e9314232ec324fb5e54e0c065 /usr.sbin/smtpd
parent126002d98bd0dea7ed54b5c0ad05a0da92b702fd (diff)
(void) cast snprintf() calls that cannot truncate
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/bounce.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c
index f074dffd35d..5850f619f9f 100644
--- a/usr.sbin/smtpd/bounce.c
+++ b/usr.sbin/smtpd/bounce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bounce.c,v 1.63 2014/04/04 16:10:41 eric Exp $ */
+/* $OpenBSD: bounce.c,v 1.64 2014/04/19 17:27:40 gilles Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@poolp.org>
@@ -152,7 +152,7 @@ bounce_add(uint64_t evpid)
TAILQ_INIT(&msg->envelopes);
msg->smtpname = xstrdup(evp.smtpname, "bounce_add");
- snprintf(buf, sizeof(buf), "%s@%s", evp.sender.user,
+ (void)snprintf(buf, sizeof(buf), "%s@%s", evp.sender.user,
evp.sender.domain);
msg->to = xstrdup(buf, "bounce_add");
nmessage += 1;
@@ -166,7 +166,7 @@ bounce_add(uint64_t evpid)
line = evp.errorline;
if (strlen(line) > 4 && (*line == '1' || *line == '6'))
line += 4;
- snprintf(buf, sizeof(buf), "%s@%s: %s\n", evp.dest.user,
+ (void)snprintf(buf, sizeof(buf), "%s@%s: %s\n", evp.dest.user,
evp.dest.domain, line);
be = xmalloc(sizeof *be, "bounce_add");
@@ -292,22 +292,23 @@ bounce_send(struct bounce_session *s, const char *fmt, ...)
}
static const char *
-bounce_duration(long long int d) {
+bounce_duration(long long int d)
+{
static char buf[32];
if (d < 60) {
- snprintf(buf, sizeof buf, "%lld second%s", d, (d == 1)?"":"s");
+ (void)snprintf(buf, sizeof buf, "%lld second%s", d, (d == 1)?"":"s");
} else if (d < 3600) {
d = d / 60;
- snprintf(buf, sizeof buf, "%lld minute%s", d, (d == 1)?"":"s");
+ (void)snprintf(buf, sizeof buf, "%lld minute%s", d, (d == 1)?"":"s");
}
else if (d < 3600 * 24) {
d = d / 3600;
- snprintf(buf, sizeof buf, "%lld hour%s", d, (d == 1)?"":"s");
+ (void)snprintf(buf, sizeof buf, "%lld hour%s", d, (d == 1)?"":"s");
}
else {
d = d / (3600 * 24);
- snprintf(buf, sizeof buf, "%lld day%s", d, (d == 1)?"":"s");
+ (void)snprintf(buf, sizeof buf, "%lld day%s", d, (d == 1)?"":"s");
}
return (buf);
};
@@ -367,7 +368,7 @@ bounce_next_message(struct bounce_session *s)
}
if ((s->msgfp = fdopen(fd, "r")) == NULL) {
- snprintf(buf, sizeof(buf), "fdopen: %s", strerror(errno));
+ (void)snprintf(buf, sizeof(buf), "fdopen: %s", strerror(errno));
log_warn("warn: bounce: fdopen");
close(fd);
bounce_delivery(msg, IMSG_QUEUE_DELIVERY_TEMPFAIL, buf);