Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Use time_t to calculate days and secs to avoid poten...



details:   https://anonhg.NetBSD.org/src/rev/9e3916196b0e
branches:  trunk
changeset: 749893:9e3916196b0e
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Dec 12 11:22:59 2009 +0000

description:
Use time_t to calculate days and secs to avoid potential overflow.

diffstat:

 sys/dev/clock_subr.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 19fd1a41c899 -r 9e3916196b0e sys/dev/clock_subr.c
--- a/sys/dev/clock_subr.c      Sat Dec 12 11:16:33 2009 +0000
+++ b/sys/dev/clock_subr.c      Sat Dec 12 11:22:59 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock_subr.c,v 1.14 2009/12/12 11:16:33 tsutsui Exp $  */
+/*     $NetBSD: clock_subr.c,v 1.15 2009/12/12 11:22:59 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock_subr.c,v 1.14 2009/12/12 11:16:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock_subr.c,v 1.15 2009/12/12 11:22:59 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -164,8 +164,9 @@
 clock_secs_to_ymdhms(time_t secs, struct clock_ymdhms *dt)
 {
        int mthdays[12];
-       int i, days;
-       int rsec;       /* remainder seconds */
+       int i;
+       time_t days;
+       time_t rsec;    /* remainder seconds */
 
        /*
         * This function uses a local copy of month_days[]



Home | Main Index | Thread Index | Old Index