Skip to content

Commit

Permalink
date.c: fix unsigned time_t comparison
Browse files Browse the repository at this point in the history
tm_to_time_t() returns (time_t)-1 when it sees an error.  On
platforms with unsigned time_t, this value will be larger than any
valid timestamp and will break the "Is this older than 10 days in
the future?" check.

Signed-off-by: Mike Gorchak <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
llmike authored and gitster committed Feb 25, 2013
1 parent 4dac067 commit e6e8751
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion date.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static int is_date(int year, int month, int day, struct tm *now_tm, time_t now,
* sense to specify timestamp way into the future. Make
* sure it is not later than ten days from now...
*/
if (now + 10*24*3600 < specified)
if ((specified != -1) && (now + 10*24*3600 < specified))
return 0;
tm->tm_mon = r->tm_mon;
tm->tm_mday = r->tm_mday;
Expand Down

0 comments on commit e6e8751

Please sign in to comment.