[PATCH 1/2] date: recognize bogus FreeBSD gmtime output

2014-04-01 Thread Jeff King
Most gmtime implementations return a NULL value when they encounter an error (and this behavior is specified by ANSI C and POSIX). FreeBSD's implementation, however, will indicate an error by returning a pointer to a struct tm with all fields set to zero. Let's also recognize this and convert it

Re: [PATCH 1/2] date: recognize bogus FreeBSD gmtime output

2014-04-01 Thread René Scharfe
Am 01.04.2014 09:42, schrieb Jeff King: diff --git a/compat/gmtime.c b/compat/gmtime.c new file mode 100644 index 000..ffcabf4 --- /dev/null +++ b/compat/gmtime.c @@ -0,0 +1,26 @@ +#include ../git-compat-util.h +#undef gmtime +#undef gmtime_r + +struct tm *git_gmtime(const time_t *timep) +{

Re: [PATCH 1/2] date: recognize bogus FreeBSD gmtime output

2014-04-01 Thread Junio C Hamano
René Scharfe l@web.de writes: Am 01.04.2014 09:42, schrieb Jeff King: diff --git a/compat/gmtime.c b/compat/gmtime.c new file mode 100644 index 000..ffcabf4 --- /dev/null +++ b/compat/gmtime.c @@ -0,0 +1,26 @@ +#include ../git-compat-util.h +#undef gmtime +#undef gmtime_r +

Re: [PATCH 1/2] date: recognize bogus FreeBSD gmtime output

2014-04-01 Thread René Scharfe
Am 01.04.2014 21:08, schrieb Junio C Hamano: René Scharfe l@web.de writes: Am 01.04.2014 09:42, schrieb Jeff King: diff --git a/compat/gmtime.c b/compat/gmtime.c new file mode 100644 index 000..ffcabf4 --- /dev/null +++ b/compat/gmtime.c @@ -0,0 +1,26 @@ +#include ../git-compat-util.h

Re: [PATCH 1/2] date: recognize bogus FreeBSD gmtime output

2014-04-01 Thread Jeff King
On Tue, Apr 01, 2014 at 11:17:14PM +0200, René Scharfe wrote: So are you saying we should set EOVERFLOW ourselves, or does FreeBSD set EOVERFLOW for us in this case and we do not have to worry? If we correct the return value then we should correct errno as well. gmtime() on FreeBSD 10