diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-07 05:00:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-07 05:00:04 +0000 |
commit | b59179c8732e7442c219abf585a2f59137de34b3 (patch) | |
tree | 8a09bba839a0bf1807f749ff53531e6beb03ab03 | |
parent | 8137c55558d8b4dfa419907cc5a5e7262a720e3b (diff) | |
download | ruby-b59179c8732e7442c219abf585a2f59137de34b3.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/date/date_core.c | 6 |
2 files changed, 9 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Tue Jun 7 13:59:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/date/date_core.c (date_s_today, datetime_s_now): check the + result of localtime_r(). + Tue Jun 7 13:36:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> * ext/tk/extconf.rb: use $defs not $CPPFLAGS to get rid of 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; |