From: Paul Eggert Date: Sat, 1 Nov 2025 23:39:07 +0000 (-0600) Subject: ls: better nstrftime failure check X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b427c185f266f5ab549e311a3c26a179d51f7d35;p=thirdparty%2Fcoreutils.git ls: better nstrftime failure check * src/ls.c (print_long_format): Streamline the checking for failure of nstrftime. --- diff --git a/src/ls.c b/src/ls.c index 5183a414e3..7144d0d9ac 100644 --- a/src/ls.c +++ b/src/ls.c @@ -4422,8 +4422,7 @@ print_long_format (const struct fileinfo *f) p[-1] = ' '; } - s = 0; - *p = '\1'; + s = -1; if (f->stat_ok && btime_ok && localtime_rz (localtz, &when_timespec.tv_sec, &when_local)) @@ -4451,11 +4450,9 @@ print_long_format (const struct fileinfo *f) whole number of seconds. */ s = align_nstrftime (p, TIME_STAMP_LEN_MAXIMUM + 1, recent, &when_local, localtz, when_timespec.tv_nsec); - if (s < 0) - s = 0; } - if (s || !*p) + if (0 <= s) { p += s; *p++ = ' ';