1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

r17812: Fix bad unsigned comparisons with TIME_T_MIN/TIME_T_MAX.

Jeremy.
(This used to be commit bd1fbdfb82)
This commit is contained in:
Jeremy Allison 2006-08-24 21:37:10 +00:00 committed by Gerald (Jerry) Carter
parent 08b63552be
commit b377324050

View File

@ -235,13 +235,13 @@ static struct timespec nt_time_to_unix_timespec(NTTIME *nt)
/* Now adjust by 369 years to make the secs since 1970 */ /* Now adjust by 369 years to make the secs since 1970 */
d -= TIME_FIXUP_CONSTANT_INT; 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_sec = TIME_T_MIN;
ret.tv_nsec = 0; ret.tv_nsec = 0;
return ret; return ret;
} }
if (d >= TIME_T_MAX) { if (((time_t)d) >= TIME_T_MAX) {
ret.tv_sec = TIME_T_MAX; ret.tv_sec = TIME_T_MAX;
ret.tv_nsec = 0; ret.tv_nsec = 0;
return ret; return ret;
@ -283,7 +283,7 @@ time_t nt_time_to_unix_abs(const NTTIME *nt)
d += 1000*1000*10/2; d += 1000*1000*10/2;
d /= 1000*1000*10; 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; return (time_t)0;
} }