touch makes open() system call even for already existing files as seen
below:
# Create file abc
$touch abc
# Attempt retouching it
$strace -e trace=open touch abc
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
*open("abc", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = 3*
+++ exited with 0 +++
$
I think this behavior of touch is not in conformance with POSIX specs
because it specifies that for existing files only *utimensat*()
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html>
should
be called and not creat.