mktime: fix non-EOVERFLOW errno handling
commit86aece3bfbd44538ba4fdc947872c81d4c5e6e61
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 15 Nov 2018 21:59:33 +0000 (15 22:59 +0100)
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Thu, 15 Nov 2018 21:59:33 +0000 (15 22:59 +0100)
tree1bf096dc1c3f3f671a48f2b8f8ef28ddf50c21d7
parentf6b3331bbae638d1bb50813fceb429d3b3dc0eb9
mktime: fix non-EOVERFLOW errno handling

[BZ#23789]
mktime was not properly reporting failures when the underlying
localtime_r fails with errno != EOVERFLOW; it incorrectly treated
them like EOVERFLOW failures, and set errno to EOVERFLOW.
The problem could happen on non-glibc platforms, with Gnulib.
* time/mktime.c (guess_time_tm): Remove, replacing with ...
(tm_diff): ... this simpler function, which does not change errno.
All callers changed to deal with errno themselves.
(ranged_convert, __mktime_internal): Return failure immediately if
the underlying function reports any failure other than EOVERFLOW.
(__mktime_internal): Set errno to EOVERFLOW if the spring-forward
gap code fails.
ChangeLog
time/mktime.c