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: Paul Eggert <eggert at cs dot ucla dot edu>
- To: "Albert ARIBAUD (3ADEV)" <albert dot aribaud at 3adev dot fr>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 25 Oct 2018 08:09:43 -0700
- Subject: Re: [PATCH] Ensure mktime sets errno on error (bug 23789)
- References: <20181024193206.22790-1-albert.aribaud@3adev.fr>
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.