Author: brooks
Date: Thu May  8 16:26:36 2014
New Revision: 265688
URL: http://svnweb.freebsd.org/changeset/base/265688

Log:
  MFC r265201
  
  Fix a 2038 bug.
  
  If time_t is 64-bit (i.e. isn't 32-bit) allow any value of year, not
  just years less than 2038.
  
  Don't bother fixing the underflow in the case of years before 1903.
  
  Sponsored by: DARPA, AFRL

Modified:
  stable/9/sys/kern/subr_clock.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_clock.c
==============================================================================
--- stable/9/sys/kern/subr_clock.c      Thu May  8 16:12:38 2014        
(r265687)
+++ stable/9/sys/kern/subr_clock.c      Thu May  8 16:26:36 2014        
(r265688)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/kernel.h>
 #include <sys/bus.h>
 #include <sys/clock.h>
+#include <sys/limits.h>
 #include <sys/sysctl.h>
 #include <sys/timetc.h>
 
@@ -147,7 +148,7 @@ clock_ct_to_ts(struct clocktime *ct, str
        if (ct->mon < 1 || ct->mon > 12 || ct->day < 1 ||
            ct->day > days_in_month(year, ct->mon) ||
            ct->hour > 23 ||  ct->min > 59 || ct->sec > 59 ||
-           ct->year > 2037) {          /* time_t overflow */
+           (sizeof(time_t) == 4 && year > 2037)) {     /* time_t overflow */
                if (ct_debug)
                        printf(" = EINVAL\n");
                return (EINVAL);
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to