summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-21 04:57:00 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-21 04:57:00 +0000
commitc2ace60b081c587532ba01ffebd6f4c1fe84e643 (patch)
tree7b147db2c14f411bb2c658af18349cd814453454 /time.c
parent1684c86c33688517b7e2b2eabf932c3868730bac (diff)
Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/time.c b/time.c
index 00061f78ff..3792701b06 100644
--- a/time.c
+++ b/time.c
@@ -13,6 +13,7 @@
#include "ruby.h"
#include <sys/types.h>
#include <time.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -1776,8 +1777,9 @@ rb_strftime(buf, format, time)
if (flen == 0) {
return 0;
}
+ errno = 0;
len = strftime(*buf, SMALLBUF, format, time);
- if (len != 0 || **buf == '\0') return len;
+ if (len != 0 || (**buf == '\0' && errno != ERANGE)) return len;
for (size=1024; ; size*=2) {
*buf = xmalloc(size);
(*buf)[0] = '\0';