← Commit list

de1a49cb4

Xabier Oneca
Xabier Oneca
2021-04-12
SUCCESS Duration: 153s

Subject

touch: fix atime set from reference file

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/touch.c+2 -1
@@ -147,7 +147,8 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
if (reference_file) {
struct stat stbuf;
xstat(reference_file, &stbuf);
- timebuf[1].tv_sec = timebuf[0].tv_sec = stbuf.st_mtime;
+ timebuf[0].tv_sec = stbuf.st_atime;
+ timebuf[1].tv_sec = stbuf.st_mtime;
/* Can use .st_mtim.tv_nsec
* (or is it .st_mtimensec?? see date.c)
* to set microseconds too.