utimensat and AT_EMPTY_PATH
Florian Weimer
fweimer@redhat.com
Thu Apr 13 17:11:00 GMT 2017
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
More information about the Libc-help
mailing list