diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2013-04-08 06:50:08 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2013-04-08 06:50:08 +0000 |
commit | ec09d7e11977579f8d0ff8618f62c00ccee5a474 (patch) | |
tree | 8ffbd69b5101498903ee9dd712003988bd2d1c18 | |
parent | 5809e7fed4d5cf4018c41b560ebc907f3276ad22 (diff) |
division of time_t does not necessarily fit in an int
spotted by deraadt@
-rw-r--r-- | usr.sbin/smtpd/to.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/to.c b/usr.sbin/smtpd/to.c index 2b2c6c9cbeb..49c52477ed5 100644 --- a/usr.sbin/smtpd/to.c +++ b/usr.sbin/smtpd/to.c @@ -1,4 +1,4 @@ -/* $OpenBSD: to.c,v 1.4 2013/02/15 22:43:21 eric Exp $ */ +/* $OpenBSD: to.c,v 1.5 2013/04/08 06:50:07 gilles Exp $ */ /* * Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net> @@ -218,7 +218,8 @@ duration_to_text(time_t t) { static char dst[64]; char buf[64]; - int d, h, m, s; + int h, m, s; + long long d; if (t == 0) { strlcpy(dst, "0s", sizeof dst); @@ -239,7 +240,7 @@ duration_to_text(time_t t) d = t / 24; if (d) { - snprintf(buf, sizeof buf, "%id", d); + snprintf(buf, sizeof buf, "%llid", d); strlcat(dst, buf, sizeof dst); } if (h) { |