stat: fix mtime/ctime/atime

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>
This commit is contained in:
Eric Lammerts 2010-10-30 02:48:20 +02:00 committed by Denys Vlasenko
parent d7559c2741
commit 66be9197a5

View File

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