Skip to contentSkip to conversation

Use long for timezone in pretty.c:show_ident_date()

PATCH In review Brian Gernhardt 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use long for timezone in pretty.c:show_ident_date()

The value is parsed with strtol and compared against LONG_MIN and LONG_MAX, which doesn't make much sense for an int.

---
 pretty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pretty.c +1 -1
index 3b811ed..29ebc4f 100644
@@ -397,7 +397,7 @@ static const char *show_ident_date(const struct ident_split *ident,
 				   enum date_mode mode)
 {
 	unsigned long date = 0;
-	int tz = 0;
+	long tz = 0;
 
 	if (ident->date_begin && ident->date_end)
 		date = strtoul(ident->date_begin, NULL, 10);
Signature · 1 line
1.9.0.281.gfc51f0a.dirty
#1 lore raw
Quoted 4 lines · Brian Gernhardt

The value is parsed with strtol and compared against LONG_MIN and LONG_MAX, which doesn't make much sense for an int.

Thanks. Find a more complete fix here [1].

[1]: http://thread.gmane.org/gmane.comp.version-control.git/243582/focus=243617

Quoted 24 lines
---
 pretty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pretty.c +1 -2
index 3b811ed..29ebc4f 100644
@@ -397,7 +397,7 @@ static const char *show_ident_date(const struct ident_split *ident,
                                   enum date_mode mode)
 {
        unsigned long date = 0;
-       int tz = 0;
+       long tz = 0;
 
        if (ident->date_begin && ident->date_end)
                date = strtoul(ident->date_begin, NULL, 10);
--

1.9.0.281.gfc51f0a.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html