bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] fdutimensat: add an atflag parameter


From: Eric Blake
Subject: Re: [PATCH] fdutimensat: add an atflag parameter
Date: Fri, 17 Sep 2010 08:34:54 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.3

On 09/17/2010 08:29 AM, Eric Blake wrote:
If you like, I can install the obvious patch.

Nah, I just did this (ignore atflag if fd is valid, and let utimensat
rather than fdutimensat validate atflag if fd was invalid):


And this, to keep the testsuite happy.
diff --git i/ChangeLog w/ChangeLog
index 5be94c1..54319d5 100644
--- i/ChangeLog
+++ w/ChangeLog
@@ -4,6 +4,8 @@
        * lib/fdutimensat.c (fdutimensat): Allow AT_SYMLINK_NOFOLLOW even
        with valid fd, to close a race scenario where futimens is
        unsupported and FILE was replaced by a symlink.
+       * tests/test-fdutimensat.c (do_fdutimens, main): Adjust test
+       accordingly.
        Suggested by Paul Eggert.

 2010-09-16  Bruno Haible  <address@hidden>
diff --git i/tests/test-fdutimensat.c w/tests/test-fdutimensat.c
index 67f03bb..80eb373 100644
--- i/tests/test-fdutimensat.c
+++ w/tests/test-fdutimensat.c
@@ -53,6 +53,7 @@ do_fdutimens (char const *name, struct timespec const times[2])
     fd = openat (dfd, name, O_RDONLY);
   errno = 0;
   result = fdutimensat (dfd, name, fd, times, 0);
+ ASSERT (fdutimensat (dfd, name, fd, times, AT_SYMLINK_NOFOLLOW) == result);
   if (0 <= fd)
     {
       int saved_errno = errno;
@@ -116,9 +117,6 @@ main (void)
   fd = creat ("file", 0600);
   ASSERT (0 <= fd);
   errno = 0;
-  ASSERT (fdutimensat (fd, ".", fd, NULL, AT_SYMLINK_NOFOLLOW) == -1);
-  ASSERT (errno == EINVAL);
-  errno = 0;
   ASSERT (fdutimensat (fd, ".", AT_FDCWD, NULL, 0) == -1);
   ASSERT (errno == ENOTDIR);
   {

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]