summaryrefslogtreecommitdiff
path: root/libc/misc/time/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/time/time.c')
-rw-r--r--libc/misc/time/time.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index 378854adc..838a3a025 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -90,6 +90,9 @@
* Defining __TIME_TZ_OPT_SPEED will cause a tzset() to keep a copy of the
* last TZ setting string and do a "fast out" if the current string is the
* same.
+ *
+ * Nov 21, 2002 Fix an error return case in _time_mktime.
+ *
*/
@@ -2022,6 +2025,10 @@ time_t _time_mktime(struct tm *timeptr, int store_on_success)
localtime_r(&t, (struct tm *)p);
+ if (t < 0) {
+ return -1;
+ }
+
if (store_on_success) {
memcpy(timeptr, p, sizeof(struct tm));
}