summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-12-31 08:55:41 +0000
committerJim Meyering <jim@meyering.net>2000-12-31 08:55:41 +0000
commit857c948551fe825421340410762ba0e4b5381345 (patch)
treebc41492323435c1e07afdc0a1d69b14e48987be3 /src
parent33cf956fc89795caa120bc262840bdd701fc9850 (diff)
downloadcoreutils-857c948551fe825421340410762ba0e4b5381345.tar.xz
(print_long_format): Don't dump core if strftime returns the empty string.
Diffstat (limited to 'src')
-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);