Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
test-date: fix sscanf type conversion
Browse files Browse the repository at this point in the history
Reading into a time_t isn't portable, since we don't know
the exact type. Instead, use an unsigned long, which is what
show_date wants, anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
peff authored and gitster committed Jul 6, 2010
1 parent b4cf0f1 commit d66ee04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test-date.c
Expand Up @@ -20,12 +20,12 @@ static void parse_dates(char **argv, struct timeval *now)
{
for (; *argv; argv++) {
char result[100];
time_t t;
unsigned long t;
int tz;

result[0] = 0;
parse_date(*argv, result, sizeof(result));
if (sscanf(result, "%ld %d", &t, &tz) == 2)
if (sscanf(result, "%lu %d", &t, &tz) == 2)
printf("%s -> %s\n",
*argv, show_date(t, tz, DATE_ISO8601));
else
Expand Down

0 comments on commit d66ee04

Please sign in to comment.