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 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.


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