From b59179c8732e7442c219abf585a2f59137de34b3 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 7 Jun 2011 05:00:04 +0000 Subject: * ext/date/date_core.c (date_s_today, datetime_s_now): check the result of localtime_r(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/date/date_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/date') 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; -- cgit v1.2.3