bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] tests: port test-fdutimensat.c to Solaris 8


From: Paul Eggert
Subject: [PATCH] tests: port test-fdutimensat.c to Solaris 8
Date: Fri, 24 Dec 2010 00:08:39 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

* tests/test-fdutimensat.c (do_fdutimens): Don't assume
fdutimensat works with a nonnegative fd and AT_SYMLINK_NOFOLLOW.
On Solaris 8, it fails with errno == ENOSYS, because there is no
futimens (so it can't use the fd), and there is no lutimens (so it
can't implement AT_SYMLINK_NOFOLLOW on symlinks).
---
 ChangeLog                |    7 +++++++
 tests/test-fdutimensat.c |    7 ++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f53bcb4..97909fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-12-23  Paul Eggert  <address@hidden>
 
+       tests: port test-fdutimensat.c to Solaris 8
+       * tests/test-fdutimensat.c (do_fdutimens): Don't assume
+       fdutimensat works with a nonnegative fd and AT_SYMLINK_NOFOLLOW.
+       On Solaris 8, it fails with errno == ENOSYS, because there is no
+       futimens (so it can't use the fd), and there is no lutimens (so it
+       can't implement AT_SYMLINK_NOFOLLOW on symlinks).
+
        vsnprintf: make more consistent with snprintf; doc fixes
 
        * doc/posix-functions/snprintf.texi (snprintf): The workaround for
diff --git a/tests/test-fdutimensat.c b/tests/test-fdutimensat.c
index d94667a..9f66cc6 100644
--- a/tests/test-fdutimensat.c
+++ b/tests/test-fdutimensat.c
@@ -48,12 +48,17 @@ static int
 do_fdutimens (char const *name, struct timespec const times[2])
 {
   int result;
+  int nofollow_result;
+  int nofollow_errno;
   int fd = openat (dfd, name, O_WRONLY);
   if (fd < 0)
     fd = openat (dfd, name, O_RDONLY);
   errno = 0;
+  nofollow_result = fdutimensat (fd, dfd, name, times, AT_SYMLINK_NOFOLLOW);
+  nofollow_errno = errno;
   result = fdutimensat (fd, dfd, name, times, 0);
-  ASSERT (fdutimensat (fd, dfd, name, times, AT_SYMLINK_NOFOLLOW) == result);
+  ASSERT (result == nofollow_result
+          || (nofollow_result == -1 && nofollow_errno == ENOSYS));
   if (0 <= fd)
     {
       int saved_errno = errno;
-- 
1.7.2




reply via email to

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