diff options
author | Eric Lammerts <busybox@lists.lammerts.org> | 2010-10-30 02:48:20 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-30 02:48:20 +0200 |
commit | 66be9197a5111d0293732f4823d1711ccab51675 (patch) | |
tree | 42a32bde5fad1f26e5aea65064931f9633383a97 | |
parent | d7559c274139c91af5ce77bd4b9f863f78a69f69 (diff) | |
download | busybox-w32-66be9197a5111d0293732f4823d1711ccab51675.tar.gz busybox-w32-66be9197a5111d0293732f4823d1711ccab51675.tar.bz2 busybox-w32-66be9197a5111d0293732f4823d1711ccab51675.zip |
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>
-rw-r--r-- | coreutils/stat.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c index b4e6f10fd..7351f5956 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -630,10 +630,9 @@ static bool do_stat(const char *filename, const char *format) | |||
630 | # if ENABLE_SELINUX | 630 | # if ENABLE_SELINUX |
631 | printf(" S_Context: %lc\n", *scontext); | 631 | printf(" S_Context: %lc\n", *scontext); |
632 | # endif | 632 | # endif |
633 | printf("Access: %s\n" "Modify: %s\n" "Change: %s\n", | 633 | printf("Access: %s\n", human_time(statbuf.st_atime)); |
634 | human_time(statbuf.st_atime), | 634 | printf("Modify: %s\n", human_time(statbuf.st_mtime)); |
635 | human_time(statbuf.st_mtime), | 635 | printf("Change: %s\n", human_time(statbuf.st_ctime)); |
636 | human_time(statbuf.st_ctime)); | ||
637 | } | 636 | } |
638 | #endif /* FEATURE_STAT_FORMAT */ | 637 | #endif /* FEATURE_STAT_FORMAT */ |
639 | return 1; | 638 | return 1; |