summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2011-10-27 14:32:58 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2011-10-27 14:32:58 +0000
commit68340e85a88a67d16b1473a49ab45d0b305b1ab6 (patch)
treedfe4f3d23df936bafe3a080e6cb7d177bd2c05d0 /usr.sbin
parent169821d872c8e101e3e932d064f2d0be4184a1d1 (diff)
Use PRI{x,d}64 in format strings instead of %llx, %lld or %qd to print {u_,}int64_t or time_t
While there, cast some time_t to int64_t These will fix build warnings for portable smptd ok gilles@ eric@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/bounce.c5
-rw-r--r--usr.sbin/smtpd/mda.c7
-rw-r--r--usr.sbin/smtpd/mta.c7
-rw-r--r--usr.sbin/smtpd/parse.y9
-rw-r--r--usr.sbin/smtpd/queue_fsqueue.c11
-rw-r--r--usr.sbin/smtpd/queue_fsqueue_ascii.c17
-rw-r--r--usr.sbin/smtpd/queue_shared.c13
-rw-r--r--usr.sbin/smtpd/ramqueue.c5
-rw-r--r--usr.sbin/smtpd/runner.c18
-rw-r--r--usr.sbin/smtpd/util.c9
10 files changed, 56 insertions, 45 deletions
diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c
index 6c729aa6ae8..09b83cb2d86 100644
--- a/usr.sbin/smtpd/bounce.c
+++ b/usr.sbin/smtpd/bounce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bounce.c,v 1.34 2011/10/23 09:30:06 gilles Exp $ */
+/* $OpenBSD: bounce.c,v 1.35 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org>
@@ -26,6 +26,7 @@
#include <err.h>
#include <event.h>
#include <imsg.h>
+#include <inttypes.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -148,7 +149,7 @@ bounce_event(int fd, short event, void *p)
out:
if (*ep == '2') {
- log_debug("#### %s: queue_envelope_delete: %016llx",
+ log_debug("#### %s: queue_envelope_delete: %016" PRIx64,
__func__, cc->m.id);
queue_envelope_delete(Q_QUEUE, &cc->m);
}
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index a2a783a2566..0e3c5c19175 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.61 2011/10/23 09:30:07 gilles Exp $ */
+/* $OpenBSD: mda.c,v 1.62 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -26,6 +26,7 @@
#include <event.h>
#include <imsg.h>
+#include <inttypes.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -220,9 +221,9 @@ mda_imsg(struct imsgev *iev, struct imsg *imsg)
/* log status */
if (error && asprintf(&error, "Error (%s)", error) < 0)
fatal("mda: asprintf");
- log_info("%016llx: to=<%s@%s>, delay=%lld, stat=%s",
+ log_info("%016" PRIx64 ": to=<%s@%s>, delay=%" PRId64 ", stat=%s",
s->msg.id, maddr->user, maddr->domain,
- (long long int) (time(NULL) - s->msg.creation),
+ (int64_t) (time(NULL) - s->msg.creation),
error ? error : "Sent");
free(error);
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index c725aafdb50..7e4ff39d3d9 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.117 2011/10/23 17:09:56 eric Exp $ */
+/* $OpenBSD: mta.c,v 1.118 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -27,6 +27,7 @@
#include <errno.h>
#include <event.h>
#include <imsg.h>
+#include <inttypes.h>
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
@@ -702,10 +703,10 @@ mta_message_log(struct mta_session *s, struct envelope *e)
struct mta_relay *relay = TAILQ_FIRST(&s->relays);
char *status = e->errorline;
- log_info("%016llx: to=<%s@%s>, delay=%lld, relay=%s [%s], stat=%s (%s)",
+ log_info("%016" PRIx64 ": to=<%s@%s>, delay=%" PRId64 ", relay=%s [%s], stat=%s (%s)",
e->id, e->dest.user,
e->dest.domain,
- (long long int) (time(NULL) - e->creation),
+ (int64_t) (time(NULL) - e->creation),
relay ? relay->fqdn : "(none)",
relay ? ss_to_text(&relay->sa) : "",
*status == '2' ? "Sent" :
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index 96676ead15c..cabc61f0311 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.81 2011/10/23 15:36:53 eric Exp $ */
+/* $OpenBSD: parse.y,v 1.82 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -40,6 +40,7 @@
#include <event.h>
#include <ifaddrs.h>
#include <imsg.h>
+#include <inttypes.h>
#include <netdb.h>
#include <paths.h>
#include <pwd.h>
@@ -190,7 +191,7 @@ quantifier : /* empty */ { $$ = 1; }
interval : NUMBER quantifier {
if ($1 < 0) {
- yyerror("invalid interval: %lld", $1);
+ yyerror("invalid interval: %" PRId64, $1);
YYERROR;
}
$$.tv_usec = 0;
@@ -200,7 +201,7 @@ interval : NUMBER quantifier {
size : NUMBER {
if ($1 < 0) {
- yyerror("invalid size: %lld", $1);
+ yyerror("invalid size: %" PRId64, $1);
YYERROR;
}
$$ = $1;
@@ -232,7 +233,7 @@ port : PORT STRING {
}
| PORT NUMBER {
if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
- yyerror("invalid port: %lld", $2);
+ yyerror("invalid port: %" PRId64, $2);
YYERROR;
}
$$ = htons($2);
diff --git a/usr.sbin/smtpd/queue_fsqueue.c b/usr.sbin/smtpd/queue_fsqueue.c
index 44f8c0ab0c5..197b8933723 100644
--- a/usr.sbin/smtpd/queue_fsqueue.c
+++ b/usr.sbin/smtpd/queue_fsqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_fsqueue.c,v 1.15 2011/10/23 13:03:05 gilles Exp $ */
+/* $OpenBSD: queue_fsqueue.c,v 1.16 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -28,6 +28,7 @@
#include <event.h>
#include <fcntl.h>
#include <imsg.h>
+#include <inttypes.h>
#include <libgen.h>
#include <pwd.h>
#include <stdio.h>
@@ -108,7 +109,7 @@ again:
goto again;
evpid = ep->id | rnd;
- if (! bsnprintf(evpname, sizeof(evpname), "%s/%08x%s/%016llx",
+ if (! bsnprintf(evpname, sizeof(evpname), "%s/%08x%s/%016" PRIx64,
fsqueue_getpath(qkind),
evpid_to_msgid(evpid),
PATH_ENVELOPES, evpid))
@@ -168,7 +169,7 @@ fsqueue_envelope_load(enum queue_kind qkind, struct envelope *ep)
FILE *fp;
int ret;
- if (! bsnprintf(pathname, sizeof(pathname), "%s/%03x/%08x%s/%016llx",
+ if (! bsnprintf(pathname, sizeof(pathname), "%s/%03x/%08x%s/%016" PRIx64,
fsqueue_getpath(qkind),
evpid_to_msgid(ep->id) & 0xfff,
evpid_to_msgid(ep->id),
@@ -202,7 +203,7 @@ fsqueue_envelope_update(enum queue_kind qkind, struct envelope *ep)
if (! bsnprintf(temp, sizeof(temp), "%s/envelope.tmp", PATH_QUEUE))
fatalx("fsqueue_envelope_update");
- if (! bsnprintf(dest, sizeof(dest), "%s/%03x/%08x%s/%016llx",
+ if (! bsnprintf(dest, sizeof(dest), "%s/%03x/%08x%s/%016" PRIx64,
fsqueue_getpath(qkind),
evpid_to_msgid(ep->id) & 0xfff,
evpid_to_msgid(ep->id),
@@ -247,7 +248,7 @@ fsqueue_envelope_delete(enum queue_kind qkind, struct envelope *ep)
{
char pathname[MAXPATHLEN];
- if (! bsnprintf(pathname, sizeof(pathname), "%s/%03x/%08x%s/%016llx",
+ if (! bsnprintf(pathname, sizeof(pathname), "%s/%03x/%08x%s/%016" PRIx64,
fsqueue_getpath(qkind),
evpid_to_msgid(ep->id) & 0xfff,
evpid_to_msgid(ep->id),
diff --git a/usr.sbin/smtpd/queue_fsqueue_ascii.c b/usr.sbin/smtpd/queue_fsqueue_ascii.c
index 3e1b546ef96..b5d06926863 100644
--- a/usr.sbin/smtpd/queue_fsqueue_ascii.c
+++ b/usr.sbin/smtpd/queue_fsqueue_ascii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_fsqueue_ascii.c,v 1.4 2011/10/23 15:36:53 eric Exp $ */
+/* $OpenBSD: queue_fsqueue_ascii.c,v 1.5 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -32,6 +32,7 @@
#include <event.h>
#include <fcntl.h>
#include <imsg.h>
+#include <inttypes.h>
#include <libgen.h>
#include <pwd.h>
#include <stdio.h>
@@ -109,7 +110,7 @@ ascii_load_evpid(struct envelope *ep, char *buf)
static int
ascii_dump_evpid(struct envelope *ep, FILE *fp)
{
- fprintf(fp, "%s: %016llx\n", KW_EVPID, ep->id);
+ fprintf(fp, "%s: %016" PRIx64 "\n", KW_EVPID, ep->id);
return 1;
}
@@ -495,8 +496,8 @@ static int
ascii_dump_ctime(struct envelope *ep, FILE *fp)
{
if (ep->creation)
- fprintf(fp, "%s: %qd\n", KW_CTIME,
- (u_int64_t)ep->creation);
+ fprintf(fp, "%s: %" PRId64 "\n", KW_CTIME,
+ (int64_t) ep->creation);
return 1;
}
@@ -516,8 +517,8 @@ static int
ascii_dump_expire(struct envelope *ep, FILE *fp)
{
if (ep->expire)
- fprintf(fp, "%s: %qd\n", KW_EXPIRE,
- (u_int64_t)ep->expire);
+ fprintf(fp, "%s: %" PRId64 "\n", KW_EXPIRE,
+ (int64_t) ep->expire);
return 1;
}
@@ -556,8 +557,8 @@ static int
ascii_dump_lasttry(struct envelope *ep, FILE *fp)
{
if (ep->lasttry)
- fprintf(fp, "%s: %qd\n", KW_LAST_TRY,
- (u_int64_t)ep->lasttry);
+ fprintf(fp, "%s: %" PRId64 "\n", KW_LAST_TRY,
+ (int64_t) ep->lasttry);
return 1;
}
diff --git a/usr.sbin/smtpd/queue_shared.c b/usr.sbin/smtpd/queue_shared.c
index 9b7a4b8e2ce..fd32686696f 100644
--- a/usr.sbin/smtpd/queue_shared.c
+++ b/usr.sbin/smtpd/queue_shared.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_shared.c,v 1.52 2011/10/23 09:30:07 gilles Exp $ */
+/* $OpenBSD: queue_shared.c,v 1.53 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -31,6 +31,7 @@
#include <event.h>
#include <fcntl.h>
#include <imsg.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -292,7 +293,7 @@ display_envelope(struct envelope *e, int flags)
status, sizeof(status));
if (e->status)
- errx(1, "%016llx: unexpected status 0x%04x", e->id,
+ errx(1, "%016" PRIx64 ": unexpected status 0x%04x", e->id,
e->status);
getflag(&e->flags, DF_BOUNCE, "BOUNCE",
@@ -305,7 +306,7 @@ display_envelope(struct envelope *e, int flags)
status, sizeof(status));
if (e->flags)
- errx(1, "%016llx: unexpected flags 0x%04x", e->id,
+ errx(1, "%016" PRIx64 ": unexpected flags 0x%04x", e->id,
e->flags);
if (status[0])
@@ -327,13 +328,13 @@ display_envelope(struct envelope *e, int flags)
printf("UNKNOWN");
}
- printf("|%016llx|%s|%s@%s|%s@%s|%lld|%lld|%u",
+ printf("|%016" PRIx64 "|%s|%s@%s|%s@%s|%" PRId64 "|%" PRId64 "|%u",
e->id,
status,
e->sender.user, e->sender.domain,
e->dest.user, e->dest.domain,
- (long long int) e->lasttry,
- (long long int) e->expire,
+ (int64_t) e->lasttry,
+ (int64_t) e->expire,
e->retry);
if (e->errorline[0] != '\0')
diff --git a/usr.sbin/smtpd/ramqueue.c b/usr.sbin/smtpd/ramqueue.c
index b6bced5ed72..ff95dfef1ed 100644
--- a/usr.sbin/smtpd/ramqueue.c
+++ b/usr.sbin/smtpd/ramqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ramqueue.c,v 1.23 2011/10/23 17:12:41 gilles Exp $ */
+/* $OpenBSD: ramqueue.c,v 1.24 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -29,6 +29,7 @@
#include <event.h>
#include <fcntl.h>
#include <imsg.h>
+#include <inttypes.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
@@ -233,7 +234,7 @@ ramqueue_expire(struct envelope *envelope, time_t curtm)
envelope->expire / 60 / 60 / 24);
bounce_record_message(envelope, &bounce);
ramqueue_insert(&env->sc_rqueue, &bounce, time(NULL));
- log_debug("#### %s: queue_envelope_delete: %016llx",
+ log_debug("#### %s: queue_envelope_delete: %016" PRIx64,
__func__, envelope->id);
queue_envelope_delete(Q_QUEUE, envelope);
return 1;
diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c
index 2ac8e61a3e2..cad84049f80 100644
--- a/usr.sbin/smtpd/runner.c
+++ b/usr.sbin/smtpd/runner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: runner.c,v 1.121 2011/10/26 20:47:31 gilles Exp $ */
+/* $OpenBSD: runner.c,v 1.122 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -31,6 +31,7 @@
#include <errno.h>
#include <event.h>
#include <imsg.h>
+#include <inttypes.h>
#include <libgen.h>
#include <pwd.h>
#include <signal.h>
@@ -88,7 +89,7 @@ runner_imsg(struct imsgev *iev, struct imsg *imsg)
* gets reinserted in ramqueue
*/
if (e->status & DS_TEMPFAILURE) {
- log_debug("TEMPFAIL: %016llx", e->id);
+ log_debug("TEMPFAIL: %016" PRIx64, e->id);
e->status &= ~DS_TEMPFAILURE;
queue_envelope_update(Q_QUEUE, e);
ramqueue_insert(&env->sc_rqueue, e, time(NULL));
@@ -101,10 +102,10 @@ runner_imsg(struct imsgev *iev, struct imsg *imsg)
*/
if (e->status & DS_PERMFAILURE) {
struct envelope bounce;
- log_debug("PERMFAIL: %016llx", e->id);
+ log_debug("PERMFAIL: %016" PRIx64, e->id);
if (e->type != D_BOUNCE &&
e->sender.user[0] != '\0') {
- log_debug("PERMFAIL #2: %016llx", e->id);
+ log_debug("PERMFAIL #2: %016" PRIx64, e->id);
bounce_record_message(e, &bounce);
ramqueue_insert(&env->sc_rqueue, &bounce, time(NULL));
runner_reset_events();
@@ -114,7 +115,7 @@ runner_imsg(struct imsgev *iev, struct imsg *imsg)
/* successful delivery or permanent failure,
* remove envelope from queue.
*/
- log_debug("#### %s: queue_envelope_delete: %016llx",
+ log_debug("#### %s: queue_envelope_delete: %016" PRIx64,
__func__, e->id);
queue_envelope_delete(Q_QUEUE, e);
return;
@@ -408,7 +409,7 @@ runner_process_envelope(struct ramqueue_envelope *rq_evp, time_t curtm)
bounce_record_message(&envelope, &bounce);
ramqueue_insert(&env->sc_rqueue, &bounce, time(NULL));
runner_setup_events();
- log_debug("#### %s: queue_envelope_delete: %016llx",
+ log_debug("#### %s: queue_envelope_delete: %016" PRIx64,
__func__, envelope.id);
queue_envelope_delete(Q_QUEUE, &envelope);
return 0;
@@ -531,7 +532,8 @@ runner_force_message_to_ramqueue(struct ramqueue *rqueue, u_int32_t msgid)
continue;
if ((evpid = filename_to_evpid(dp->d_name)) == 0) {
- log_warnx("runner_force_message_to_ramqueue: invalid evpid: %016llx", evpid);
+ log_warnx("runner_force_message_to_ramqueue: "
+ "invalid evpid: %016" PRIx64, evpid);
continue;
}
@@ -727,7 +729,7 @@ runner_remove_envelope(struct ramqueue *rq, struct ramqueue_envelope *rq_evp)
struct envelope evp;
if (queue_envelope_load(Q_QUEUE, rq_evp->evpid, &evp)) {
- log_debug("#### %s: queue_envelope_delete: %016llx",
+ log_debug("#### %s: queue_envelope_delete: %016" PRIx64,
__func__, evp.id);
queue_envelope_delete(Q_QUEUE, &evp);
}
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 128a6275211..a627e5ae89d 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.48 2011/10/23 09:30:07 gilles Exp $ */
+/* $OpenBSD: util.c,v 1.49 2011/10/27 14:32:57 chl Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -34,6 +34,7 @@
#include <event.h>
#include <fcntl.h>
#include <imsg.h>
+#include <inttypes.h>
#include <libgen.h>
#include <netdb.h>
#include <pwd.h>
@@ -566,14 +567,14 @@ evpid_generate(u_int32_t msgid)
u_int64_t ret;
ret = msgid;
- log_debug("evpid_generate: %016llx", ret);
+ log_debug("evpid_generate: %016" PRIx64, ret);
ret <<= 32;
- log_debug("evpid_generate: %016llx", ret);
+ log_debug("evpid_generate: %016" PRIx64, ret);
do {
ret |= arc4random();
} while ((ret & 0xffffffff) == 0);
- log_debug("evpid_generate: %016llx", ret);
+ log_debug("evpid_generate: %016" PRIx64, ret);
return ret;
}