Author: jra
Date: 2006-08-24 21:37:10 +0000 (Thu, 24 Aug 2006)
New Revision: 17812

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17812

Log:
Fix bad unsigned comparisons with TIME_T_MIN/TIME_T_MAX.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/time.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0/source/lib/time.c        2006-08-24 21:32:30 UTC (rev 
17811)
+++ branches/SAMBA_3_0/source/lib/time.c        2006-08-24 21:37:10 UTC (rev 
17812)
@@ -235,13 +235,13 @@
        /* Now adjust by 369 years to make the secs since 1970 */
        d -= TIME_FIXUP_CONSTANT_INT;
 
-       if (d <= TIME_T_MIN) {
+       if (((time_t)d) <= TIME_T_MIN) {
                ret.tv_sec = TIME_T_MIN;
                ret.tv_nsec = 0;
                return ret;
        }
 
-       if (d >= TIME_T_MAX) {
+       if (((time_t)d) >= TIME_T_MAX) {
                ret.tv_sec = TIME_T_MAX;
                ret.tv_nsec = 0;
                return ret;
@@ -283,7 +283,7 @@
        d += 1000*1000*10/2;
        d /= 1000*1000*10;
 
-       if (!(TIME_T_MIN <= d && d <= TIME_T_MAX)) {
+       if (!(TIME_T_MIN <= ((time_t)d) && ((time_t)d) <= TIME_T_MAX)) {
                return (time_t)0;
        }
 

Reply via email to