Re: [PATCH] Use utime rather than utimes

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

 



On Wed, 2010-03-10 at 12:35 +0100, Kay Sievers wrote:
> On Wed, Mar 10, 2010 at 10:22, Martin Pitt <martin.pitt@xxxxxxxxxx> 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;
 				}
 			}

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux