diff options
Diffstat (limited to 'ext/date/date_core.c')
-rw-r--r-- | ext/date/date_core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 309ecfaf6c..e8c7a5f69f 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -3483,7 +3483,8 @@ date_s_today(int argc, VALUE *argv, VALUE klass) if (time(&t) == -1) rb_sys_fail("time"); - localtime_r(&t, &tm); + if (!localtime_r(&t, &tm)) + rb_sys_fail("localtime"); y = tm.tm_year + 1900; m = tm.tm_mon + 1; @@ -7288,7 +7289,8 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass) rb_sys_fail("gettimeofday"); sec = tv.tv_sec; #endif - localtime_r(&sec, &tm); + if (!localtime_r(&sec, &tm)) + rb_sys_fail("localtime"); y = tm.tm_year + 1900; m = tm.tm_mon + 1; |