From 7dd42a48e10ce0b5bec57b7f0833aec0f7c0693a Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 21 Apr 2008 00:59:43 +0000 Subject: * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@16113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'time.c') diff --git a/time.c b/time.c index 74c6684c7c..ba4c69ef0a 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'; -- cgit v1.2.3