-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 9/4/2009 11:58 AM: > Unfortunately, I don't have linkat working yet
Still true, but here's another piece of the puzzle. fcntl_h.m4 created a symlink conftest.sym, but never cleaned it up; as a result, an ill-timed link-follow.m4 failed to create a symlink by the same name and was aborting, and assuming incorrectly that Linux link() follows symlinks. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkq4wzAACgkQ84KuGfSFAYDlJQCg2VToru/LBjOUiW25ToR5SgEn TAQAnAzl9fRPqOZWuy02uxA/mVB5jRu7 =XpS7 -----END PGP SIGNATURE-----
>From da5d03a925021685437c7e574458f66fbe56bd37 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Tue, 22 Sep 2009 06:24:25 -0600 Subject: [PATCH] link-follow: ensure correct result * m4/fcntl_h.m4 (gl_FCNTL_H): Clean up temporary file. * m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Distinguish between possible failures. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 7 +++++++ m4/fcntl_h.m4 | 3 ++- m4/link-follow.m4 | 10 +++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f275dd..d80af61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-09-22 Eric Blake <e...@byu.net> + + link-follow: ensure correct result + * m4/fcntl_h.m4 (gl_FCNTL_H): Clean up temporary file. + * m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Distinguish + between possible failures. + 2009-09-21 Eric Blake <e...@byu.net> open, openat: minor optimization diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index 5eed088..118a4fa 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 4 +# serial 5 # Configure fcntl.h. dnl Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -38,6 +38,7 @@ AC_DEFUN([gl_FCNTL_H], if (symlink (".", sym) != 0 || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) status |= 32; + unlink (sym); } { static char const file[] = "confdefs.h"; diff --git a/m4/link-follow.m4 b/m4/link-follow.m4 index 48885ea..2043670 100644 --- a/m4/link-follow.m4 +++ b/m4/link-follow.m4 @@ -1,4 +1,4 @@ -# serial 14 +# serial 15 dnl Run a program to determine whether link(2) follows symlinks. dnl Set LINK_FOLLOWS_SYMLINKS accordingly. @@ -47,16 +47,16 @@ AC_DEFUN([gl_FUNC_LINK_FOLLOWS_SYMLINK], /* Create a symlink to the regular file. */ if (symlink (file, sym)) - abort (); + return 2; /* Create a hard link to that symlink. */ if (link (sym, hard)) - abort (); + return 3; if (lstat (hard, &sb_hard)) - abort (); + return 4; if (lstat (file, &sb_file)) - abort (); + return 5; /* If the dev/inode of hard and file are the same, then the link call followed the symlink. */ -- 1.6.5.rc1