summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2013-04-09 14:51:34 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2013-04-09 14:51:34 +0000
commit98b9fc0fb7abdd6bdd83b37142147bcbff788e03 (patch)
treeeb05667524676883375305859b527e9a96eb10b3
parent33dd6f29f56629407600e53ded11dd676edf19ff (diff)
do not store a time_t or the result of a time_t division in an int
prompted by deraadt@, ok claudio@ chl@ guenther@
-rw-r--r--usr.sbin/bgpctl/bgpctl.c7
-rw-r--r--usr.sbin/dvmrpctl/dvmrpctl.c7
-rw-r--r--usr.sbin/ospfctl/ospfctl.c7
-rw-r--r--usr.sbin/ripctl/ripctl.c7
4 files changed, 16 insertions, 12 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 888e0de4717..a23699aa12d 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.169 2013/03/07 21:28:34 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.170 2013/04/09 14:51:33 gilles Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -824,7 +824,8 @@ fmt_timeframe_core(time_t t)
char *buf;
static char tfbuf[TF_BUFS][TF_LEN]; /* ring buffer */
static int idx = 0;
- unsigned int sec, min, hrs, day, week;
+ unsigned int sec, min, hrs, day;
+ unsigned long long week;
buf = tfbuf[idx++];
if (idx == TF_BUFS)
@@ -842,7 +843,7 @@ fmt_timeframe_core(time_t t)
week /= 7;
if (week > 0)
- snprintf(buf, TF_LEN, "%02uw%01ud%02uh", week, day, hrs);
+ snprintf(buf, TF_LEN, "%02lluw%01ud%02uh", week, day, hrs);
else if (day > 0)
snprintf(buf, TF_LEN, "%01ud%02uh%02um", day, hrs, min);
else
diff --git a/usr.sbin/dvmrpctl/dvmrpctl.c b/usr.sbin/dvmrpctl/dvmrpctl.c
index 8cf8473afe9..1fba47be384 100644
--- a/usr.sbin/dvmrpctl/dvmrpctl.c
+++ b/usr.sbin/dvmrpctl/dvmrpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvmrpctl.c,v 1.9 2009/11/02 20:32:17 claudio Exp $ */
+/* $OpenBSD: dvmrpctl.c,v 1.10 2013/04/09 14:51:33 gilles Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -449,7 +449,8 @@ fmt_timeframe_core(time_t t)
char *buf;
static char tfbuf[TF_BUFS][TF_LEN]; /* ring buffer */
static int idx = 0;
- unsigned int sec, min, hrs, day, week;
+ unsigned int sec, min, hrs, day;
+ unsigned long long week;
if (t == 0)
return ("Stopped");
@@ -470,7 +471,7 @@ fmt_timeframe_core(time_t t)
week /= 7;
if (week > 0)
- snprintf(buf, TF_LEN, "%02uw%01ud%02uh", week, day, hrs);
+ snprintf(buf, TF_LEN, "%02lluw%01ud%02uh", week, day, hrs);
else if (day > 0)
snprintf(buf, TF_LEN, "%01ud%02uh%02um", day, hrs, min);
else
diff --git a/usr.sbin/ospfctl/ospfctl.c b/usr.sbin/ospfctl/ospfctl.c
index decd73359d7..47be03b0e7a 100644
--- a/usr.sbin/ospfctl/ospfctl.c
+++ b/usr.sbin/ospfctl/ospfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfctl.c,v 1.56 2011/05/09 12:25:35 claudio Exp $ */
+/* $OpenBSD: ospfctl.c,v 1.57 2013/04/09 14:51:33 gilles Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -521,7 +521,8 @@ fmt_timeframe_core(time_t t)
char *buf;
static char tfbuf[TF_BUFS][TF_LEN]; /* ring buffer */
static int idx = 0;
- unsigned int sec, min, hrs, day, week;
+ unsigned int sec, min, hrs, day;
+ unsigned long long week;
if (t == 0)
return ("00:00:00");
@@ -542,7 +543,7 @@ fmt_timeframe_core(time_t t)
week /= 7;
if (week > 0)
- snprintf(buf, TF_LEN, "%02uw%01ud%02uh", week, day, hrs);
+ snprintf(buf, TF_LEN, "%02lluw%01ud%02uh", week, day, hrs);
else if (day > 0)
snprintf(buf, TF_LEN, "%01ud%02uh%02um", day, hrs, min);
else
diff --git a/usr.sbin/ripctl/ripctl.c b/usr.sbin/ripctl/ripctl.c
index 939af71b3d6..7ca78a5588f 100644
--- a/usr.sbin/ripctl/ripctl.c
+++ b/usr.sbin/ripctl/ripctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripctl.c,v 1.10 2009/11/02 20:29:17 claudio Exp $
+/* $OpenBSD: ripctl.c,v 1.11 2013/04/09 14:51:33 gilles Exp $
*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -244,7 +244,8 @@ fmt_timeframe_core(time_t t)
char *buf;
static char tfbuf[TF_BUFS][TF_LEN]; /* ring buffer */
static int idx = 0;
- unsigned int sec, min, hrs, day, week;
+ unsigned int sec, min, hrs, day;
+ unsigned long long week;
if (t == 0)
return ("Stopped");
@@ -265,7 +266,7 @@ fmt_timeframe_core(time_t t)
week /= 7;
if (week > 0)
- snprintf(buf, TF_LEN, "%02uw%01ud%02uh", week, day, hrs);
+ snprintf(buf, TF_LEN, "%02lluw%01ud%02uh", week, day, hrs);
else if (day > 0)
snprintf(buf, TF_LEN, "%01ud%02uh%02um", day, hrs, min);
else