Hi Denys,

> Applied, thank you

You over-shrunk the code and omitted what seems to be a fundamental
part of the logic of the applet. Now 'touch -am file' does not update
times.

Here's the merged hunk where the bug is:

-    if ((opts & (OPT_a | OPT_m)) && !newtime) {
-        time(&timebuf[0].tv_sec);
-        timebuf[1].tv_sec = timebuf[0].tv_sec;
-        newtime = timebuf;
+    if (opts & OPT_a) {
+        timebuf[1].tv_nsec = UTIME_OMIT;
+    }
+    if (opts & OPT_m) {
+        timebuf[0].tv_nsec = UTIME_OMIT;
     }

>From https://pubs.opengroup.org/onlinepubs/007904975/utilities/touch.html:

   -a  Change the access time of file. Do not change the modification
time unless -m is also specified.
   -m  Change the modification time of file. Do not change the access
time unless -a is also specified.

Cheers,

Xabier Oneca_,,_
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to