summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ls.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ls.c b/src/ls.c
index ed1783da7..ac9a37ab1 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2453,7 +2453,10 @@ print_long_format (const struct fileinfo *f)
if ((when_local = localtime (&when)))
{
- while (! (s = strftime (p, buf + bufsize - p - 1, fmt, when_local)))
+ *p = '\1';
+
+ while (! (s = strftime (p, buf + bufsize - p - 1, fmt, when_local))
+ && *p)
{
char *newbuf = (char *) alloca (bufsize *= 2);
memcpy (newbuf, buf, p - buf);