This is the mail archive of the
mailing list for the glibc project.
Re: utimensat and AT_EMPTY_PATH
- From: Florian Weimer <fweimer at redhat dot com>
- To: Ian Pilcher <arequipeno at gmail dot com>, libc-help at sourceware dot org
- Date: Thu, 13 Apr 2017 19:11:31 +0200
- Subject: Re: utimensat and AT_EMPTY_PATH
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E06B661E4B
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E06B661E4B
- References: <email@example.com>
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
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.