bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] fcntl-h: check for AIX 7.1 bug with O_NOFOLLOW and O_CREAT


From: Paul Eggert
Subject: [PATCH] fcntl-h: check for AIX 7.1 bug with O_NOFOLLOW and O_CREAT
Date: Mon, 10 Sep 2012 13:51:36 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

* m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Check for AIX 7.1 bug
that caused a GNU tar test failure.  Problem reported by Jez Wain; see
<http://lists.gnu.org/archive/html/bug-tar/2012-07/msg00018.html>.
---
 ChangeLog     |  7 +++++++
 m4/fcntl-o.m4 | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 282e060..18225e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-10  Paul Eggert  <address@hidden>
+
+       fcntl-h: check for AIX 7.1 bug with O_NOFOLLOW and O_CREAT
+       * m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Check for AIX 7.1 bug
+       that caused a GNU tar test failure.  Problem reported by Jez Wain; see
+       <http://lists.gnu.org/archive/html/bug-tar/2012-07/msg00018.html>.
+
 2012-09-06  Eric Blake  <address@hidden>
 
        net_if: give more details about the bug being fixed
diff --git a/m4/fcntl-o.m4 b/m4/fcntl-o.m4
index 9862741..a413810 100644
--- a/m4/fcntl-o.m4
+++ b/m4/fcntl-o.m4
@@ -50,7 +50,18 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
             #if HAVE_SYMLINK
             {
               static char const sym[] = "conftest.sym";
-              if (symlink (".", sym) != 0)
+              if (symlink ("/dev/null", sym) != 0)
+                result |= 2;
+              else
+                {
+                  int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0);
+                  if (fd >= 0)
+                    {
+                      close (fd);
+                      result |= 4;
+                    }
+                }
+              if (unlink (sym) != 0 || symlink (".", sym) != 0)
                 result |= 2;
               else
                 {
-- 
1.7.11.4




reply via email to

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