changeset 17079:3715020c3d08

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>.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 10 Sep 2012 13:37:18 -0700
parents b9c7d3214b0f
children 0d7ea434801b
files ChangeLog m4/fcntl-o.m4
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+	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  <eblake@redhat.com>
 
 	net_if: give more details about the bug being fixed
--- a/m4/fcntl-o.m4
+++ b/m4/fcntl-o.m4
@@ -50,7 +50,18 @@
             #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 |= 1;
+                    }
+                }
+              if (unlink (sym) != 0 || symlink (".", sym) != 0)
                 result |= 2;
               else
                 {