[PATCH] Ensure mktime sets errno on error (bug 23789)
Paul Eggert
eggert@cs.ucla.edu
Thu Oct 25 15:27:00 GMT 2018
On 10/24/18 12:32 PM, Albert ARIBAUD (3ADEV) wrote:
> + result = __mktime_internal (tp, __localtime_r, &localtime_offset);
> + if (result == -1)
> + {
> + __set_errno(EOVERFLOW);
> + }
A couple of other points. First, mktime can fail for reasons other than
EOVERFLOW; for example, mktime can exhaust memory due to an internal
malloc failure. In these cases mktime should set errno to the
appropriate error number, not to EOVERFLOW.
Second, a nit: please avoid the curly braces in simple cases like the above.
More information about the Libc-alpha
mailing list