From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Wed, 10 Mar 2010 11:47:56 +0000 Subject: Re: [PATCH] Use utime rather than utimes Message-Id: <1268221676.1950.1.camel@yio.site> List-Id: References: <1268195770-20935-1-git-send-email-jon@ringle.org> In-Reply-To: <1268195770-20935-1-git-send-email-jon@ringle.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Wed, 2010-03-10 at 12:35 +0100, Kay Sievers wrote: > On Wed, Mar 10, 2010 at 10:22, Martin Pitt wrote: > > Kay Sievers [2010-03-10 9:34 +0100]: > >> utime(): POSIX.1-2008 marks utime() as obsolete. > > > > That's actually what the manpage says, indeed. However, it contradicts > > what's written in the standard: > > > > http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html#tag_13_64 > > > > says utimes() is obsolete and > > > > http://www.opengroup.org/onlinepubs/009695399/basedefs/utime.h.html#tag_13_81 > > > > says nothing about being obsolete. However, this might not be _the_ > > POSIX standard? > > Sounds all pretty weird. Maybe we just go for utimensat(AT_FDCWD, > ..., if that is in uclibc. Jon, care to check? Jon, care to try if this compiles? Thanks, Kay diff --git a/udev/udev-node.c b/udev/udev-node.c index a70c147..23bfade 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -57,7 +57,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod preserve = 1; udev_selinux_lsetfilecon(udev, file, mode); /* update time stamp when we re-use the node, like on media change events */ - utimes(file, NULL); + utimensat(AT_FDCWD, file, NULL, 0); } else { char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; @@ -178,7 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) info(udev, "preserve already existing symlink '%s' to '%s'\n", slink, target); udev_selinux_lsetfilecon(udev, slink, S_IFLNK); - lutimes(slink, NULL); + utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); goto exit; } }