This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Ensure mktime sets errno on error (bug 23789)
Hi Paul,
On Thu, 25 Oct 2018 01:30:45 -0700, Paul Eggert <eggert@cs.ucla.edu>
wrote :
> Albert ARIBAUD (3ADEV) wrote:
> > + if (result == -1)
> > + {
> > + __set_errno(EOVERFLOW);
> > + }
>
> This patch is not correct since -1 is a valid time_t value, and a result of -1
> does not necessarily indicate time_t overflow.
While a do agree that -1 is a valid time_t value in general terms, in
the specific case of the mktime() return values, -1 is the value
returned on error, as per the manual page and as per Posix:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mktime.html
Cordialement,
Albert ARIBAUD
3ADEV