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 <[email protected]>
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 [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org