summaryrefslogtreecommitdiffstats
path: root/time.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-21 00:59:43 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-21 00:59:43 +0000
commit0559e89c292013f81817742966fa55b6f96443da (patch)
treedb90c318e1e8c52ace50ea85982f2d41ac380a25 /time.c
parentfec64f3c56d66f0ea138036766fd0beb59cf1a7c (diff)
downloadruby-0559e89c292013f81817742966fa55b6f96443da.tar.gz
ruby-0559e89c292013f81817742966fa55b6f96443da.tar.xz
ruby-0559e89c292013f81817742966fa55b6f96443da.zip
* time.c (rb_strftime): check errno to detect strftime(3)'s error.
this is workaround for recent version of MSVCRT. [ruby-dev:34456] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/time.c b/time.c
index 74c6684c7..ba4c69ef0 100644
--- a/time.c
+++ b/time.c
@@ -2003,8 +2003,9 @@ rb_strftime(char **buf, const char *format, struct tm *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';