Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 1/1] Fix unsigned time_t comparison

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:15

Mike Gorchak [off-list ref] writes:
quoted hunk
Do not compare time_t (less comparison) with -1. If time_t
is unsigned this leads to always true comparison.

Signed-off-by: Mike Gorchak <redacted>
---
 date.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/date.c b/date.c
index 57331ed..1ac28e5 100644
--- a/date.c
+++ b/date.c
@@ -383,7 +383,7 @@ static int is_date(int year, int month, int day,
struct tm *now_tm, time_t now,
Line-wrapped.  Will manually fix while applying.

Thanks.
 		 * 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;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help