This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Ensure mktime sets errno on error (bug 23789)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]