This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: utimensat and AT_EMPTY_PATH


On 04/10/2017 06:05 PM, Ian Pilcher wrote:
Given a file descriptor that refers to a symbolic link, is there a way
to call utimensat (or some other function) to update its timestamp?

I.e. what I would like to do is:

   utimensat(linkfd, "", times, AT_EMPTY_PATH);

Unlike futimens, utimensat *can* update the timestamp of a symlink
(verified with "strace touch -h ..."), but it doesn't seem to accept
AT_EMPTY_PATH.

Is there any non-racy way to do this?

Usually, it's possible to use the non-f, non-at system call variants with a /proc/fd/%d path. Those appear as symbolic links in the proc file system, but they actually are not, and the kernel will do the right thing even when operating on O_PATH descriptors.

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]