stat: fix mtime/ctime/atime
authorEric Lammerts <busybox@lists.lammerts.org>
Sat, 30 Oct 2010 00:48:20 +0000 (02:48 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 30 Oct 2010 00:48:20 +0000 (02:48 +0200)
If you set CONFIG_FEATURE_STAT_FORMAT=n, two of the three printed
times are wrong, because a global buffer is reused. Fix below.

Signed-off-by: Eric Lammerts <busybox@lists.lammerts.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/stat.c

index b4e6f10fd269a81f741e24ac148f2288bb2f56d3..7351f595630d405bacd2deb9208a46f2da5e6514 100644 (file)
@@ -630,10 +630,9 @@ static bool do_stat(const char *filename, const char *format)
 # if ENABLE_SELINUX
                printf("   S_Context: %lc\n", *scontext);
 # endif
-               printf("Access: %s\n" "Modify: %s\n" "Change: %s\n",
-                      human_time(statbuf.st_atime),
-                      human_time(statbuf.st_mtime),
-                      human_time(statbuf.st_ctime));
+               printf("Access: %s\n", human_time(statbuf.st_atime));
+               printf("Modify: %s\n", human_time(statbuf.st_mtime));
+               printf("Change: %s\n", human_time(statbuf.st_ctime));
        }
 #endif  /* FEATURE_STAT_FORMAT */
        return 1;