diff options
author | Xabier Oneca <xoneca@gmail.com> | 2021-04-08 02:05:37 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-04-12 20:05:48 +0200 |
commit | de1a49cb419d931a62500eaddb7c888ee011eefe (patch) | |
tree | 3e016e5fd33cc29264da35cf2dd15d1e8cc27732 | |
parent | 520bb3eac2627e2f6bda05ceb2e3e7db71b73dd3 (diff) | |
download | busybox-w32-de1a49cb419d931a62500eaddb7c888ee011eefe.tar.gz busybox-w32-de1a49cb419d931a62500eaddb7c888ee011eefe.tar.bz2 busybox-w32-de1a49cb419d931a62500eaddb7c888ee011eefe.zip |
touch: fix atime set from reference file
When using a file's times as reference, use both atime and mtime for the files
to be modified.
Signed-off-by: Xabier Oneca <xoneca@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/touch.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c index dff68cb00..68fb625fe 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -147,7 +147,8 @@ int touch_main(int argc UNUSED_PARAM, char **argv) | |||
147 | if (reference_file) { | 147 | if (reference_file) { |
148 | struct stat stbuf; | 148 | struct stat stbuf; |
149 | xstat(reference_file, &stbuf); | 149 | xstat(reference_file, &stbuf); |
150 | timebuf[1].tv_sec = timebuf[0].tv_sec = stbuf.st_mtime; | 150 | timebuf[0].tv_sec = stbuf.st_atime; |
151 | timebuf[1].tv_sec = stbuf.st_mtime; | ||
151 | /* Can use .st_mtim.tv_nsec | 152 | /* Can use .st_mtim.tv_nsec |
152 | * (or is it .st_mtimensec?? see date.c) | 153 | * (or is it .st_mtimensec?? see date.c) |
153 | * to set microseconds too. | 154 | * to set microseconds too. |