summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
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 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';