coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

touch: why try utimesat when open already failed with EACCESS?


From: Bernhard Voelker
Subject: touch: why try utimesat when open already failed with EACCESS?
Date: Fri, 09 Dec 2011 13:34:35 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111101 SUSE/3.1.16 Thunderbird/3.1.16

Why does touch try to set the time when fd_open already failed
with with EACCESS?

Run as a normal user:

strace touch /x
...
open("/x", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = -1 EACCES (Permission 
denied)
utimensat(AT_FDCWD, "/x", NULL, 0)      = -1 ENOENT (No such file or directory)

Is there a chance on any system that setting the time succeeds
after the EACCESS? Or is this just to keep the function flow
simpler by having the diagnostic centrally afterwards?

Thank you & have a nice day,
Berny




reply via email to

[Prev in Thread] Current Thread [Next in Thread]