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)
- From: Zack Weinberg <zackw at panix dot com>
- To: Albert ARIBAUD <albert dot aribaud at 3adev dot fr>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 24 Oct 2018 20:04:11 -0400
- Subject: Re: [PATCH] Ensure mktime sets errno on error (bug 23789)
- References: <20181024193206.22790-1-albert.aribaud@3adev.fr>
On Wed, Oct 24, 2018 at 3:32 PM Albert ARIBAUD (3ADEV)
<albert.aribaud@3adev.fr> wrote:
>
> Posix mandates that mktime set errno to EOVERFLOW
> on error, that it, upon retuning -1, but the glibc
> mktime does not so far on 32-bit architectures.
...
> # if defined _LIBC || NEED_MKTIME_WORKING
> static mktime_offset_t localtime_offset;
> - return __mktime_internal (tp, __localtime_r, &localtime_offset);
> + result = __mktime_internal (tp, __localtime_r, &localtime_offset);
> # else
> # undef mktime
> - return mktime (tp);
> + result = mktime (tp);
> # endif
> + if (result == -1)
> + {
> + __set_errno(EOVERFLOW);
> + }
> + return result;
Why do you make this change in the `mktime` wrapper instead of
`__mktime_internal`?
zw