changeset 12057:aee865e7b49f

symlink: use throughout gnulib * m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Omit symlink check. * lib/symlinkat.c (symlinkat) [!HAVE_SYMLINK]: Document why symlink is not used. * modules/symlinkat (Depends-on): Add symlink. * modules/canonicalize-lgpl-tests (Depends-on): Likewise. * modules/canonicalize-tests (Depends-on): Likewise. * modules/lstat-tests (Depends-on): Likewise. * modules/openat-tests (Depends-on): Likewise. * modules/remove-tests (Depends-on): Likewise. * modules/rmdir-tests (Depends-on): Likewise. * modules/unlink-tests (Depends-on): Likewise. * tests/test-canonicalize-lgpl.c (symlink): Delete stub. * tests/test-canonicalize.c (symlink): Likewise. * tests/test-fstatat.c (symlink): Likewise. * tests/test-lstat.c (symlink): Likewise. * tests/test-remove.c (symlink): Likewise. * tests/test-rmdir.c (symlink): Likewise. * tests/test-unlink.c (symlink): Likewise. * tests/test-unlinkat.c (symlink): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Sat, 19 Sep 2009 21:58:11 -0600
parents e0c5d88f8c3b
children 36183b482b71
files ChangeLog lib/symlinkat.c m4/symlinkat.m4 modules/canonicalize-lgpl-tests modules/canonicalize-tests modules/lstat-tests modules/openat-tests modules/remove-tests modules/rmdir-tests modules/symlinkat modules/unlink-tests tests/test-canonicalize-lgpl.c tests/test-canonicalize.c tests/test-fstatat.c tests/test-lstat.c tests/test-remove.c tests/test-rmdir.c tests/test-unlink.c tests/test-unlinkat.c
diffstat 19 files changed, 33 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
 2009-09-23  Eric Blake  <ebb9@byu.net>
 
+	symlink: use throughout gnulib
+	* m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Omit symlink check.
+	* lib/symlinkat.c (symlinkat) [!HAVE_SYMLINK]: Document why
+	symlink is not used.
+	* modules/symlinkat (Depends-on): Add symlink.
+	* modules/canonicalize-lgpl-tests (Depends-on): Likewise.
+	* modules/canonicalize-tests (Depends-on): Likewise.
+	* modules/lstat-tests (Depends-on): Likewise.
+	* modules/openat-tests (Depends-on): Likewise.
+	* modules/remove-tests (Depends-on): Likewise.
+	* modules/rmdir-tests (Depends-on): Likewise.
+	* modules/unlink-tests (Depends-on): Likewise.
+	* tests/test-canonicalize-lgpl.c (symlink): Delete stub.
+	* tests/test-canonicalize.c (symlink): Likewise.
+	* tests/test-fstatat.c (symlink): Likewise.
+	* tests/test-lstat.c (symlink): Likewise.
+	* tests/test-remove.c (symlink): Likewise.
+	* tests/test-rmdir.c (symlink): Likewise.
+	* tests/test-unlink.c (symlink): Likewise.
+	* tests/test-unlinkat.c (symlink): Likewise.
+
 	symlink: new module, for Solaris 9 bug
 	* modules/symlink: New file.
 	* m4/symlink.m4 (gl_FUNC_SYMLINK): Likewise.
--- a/lib/symlinkat.c
+++ b/lib/symlinkat.c
@@ -21,7 +21,8 @@
 #include <unistd.h>
 
 #if !HAVE_SYMLINK
-/* Mingw lacks symlink, so this wrapper is trivial.  */
+/* Mingw lacks symlink, and it is more efficient to provide a trivial
+   wrapper than to go through at-func.c to call rpl_symlink.  */
 
 # include <errno.h>
 
--- a/m4/symlinkat.m4
+++ b/m4/symlinkat.m4
@@ -1,4 +1,4 @@
-# serial 2
+# serial 3
 # See if we need to provide symlinkat/readlinkat replacement.
 
 dnl Copyright (C) 2009 Free Software Foundation, Inc.
@@ -13,7 +13,7 @@
   AC_REQUIRE([gl_FUNC_OPENAT])
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_CHECK_FUNCS_ONCE([symlink symlinkat readlinkat])
+  AC_CHECK_FUNCS_ONCE([symlinkat readlinkat])
   if test $ac_cv_func_symlinkat = no; then
     # No known system has readlinkat but not symlinkat
     HAVE_SYMLINKAT=0
--- a/modules/canonicalize-lgpl-tests
+++ b/modules/canonicalize-lgpl-tests
@@ -3,9 +3,9 @@
 
 Depends-on:
 same-inode
+symlink
 
 configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
 
 Makefile.am:
 TESTS += test-canonicalize-lgpl
--- a/modules/canonicalize-tests
+++ b/modules/canonicalize-tests
@@ -4,9 +4,9 @@
 Depends-on:
 progname
 same-inode
+symlink
 
 configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
 
 Makefile.am:
 TESTS += test-canonicalize
--- a/modules/lstat-tests
+++ b/modules/lstat-tests
@@ -6,9 +6,9 @@
 errno
 same-inode
 stdbool
+symlink
 
 configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
 
 Makefile.am:
 TESTS += test-lstat
--- a/modules/openat-tests
+++ b/modules/openat-tests
@@ -9,10 +9,10 @@
 
 Depends-on:
 pathmax
+symlink
 unlinkdir
 
 configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
 
 Makefile.am:
 TESTS += test-fstatat test-openat test-unlinkat
--- a/modules/remove-tests
+++ b/modules/remove-tests
@@ -2,10 +2,10 @@
 tests/test-remove.c
 
 Depends-on:
+symlink
 sys_stat
 
 configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
 
 Makefile.am:
 TESTS += test-remove
--- a/modules/rmdir-tests
+++ b/modules/rmdir-tests
@@ -4,9 +4,9 @@
 
 Depends-on:
 stdbool
+symlink
 
 configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
 
 Makefile.am:
 TESTS += test-rmdir
--- a/modules/symlinkat
+++ b/modules/symlinkat
@@ -10,6 +10,7 @@
 fcntl-h
 openat
 readlink
+symlink
 unistd
 
 configure.ac:
--- a/modules/unlink-tests
+++ b/modules/unlink-tests
@@ -4,10 +4,10 @@
 
 Depends-on:
 stdbool
+symlink
 unlinkdir
 
 configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
 
 Makefile.am:
 TESTS += test-unlink
--- a/tests/test-canonicalize-lgpl.c
+++ b/tests/test-canonicalize-lgpl.c
@@ -29,10 +29,6 @@
 
 #include "same-inode.h"
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif /* !HAVE_SYMLINK */
-
 #define ASSERT(expr) \
   do									     \
     {									     \
--- a/tests/test-canonicalize.c
+++ b/tests/test-canonicalize.c
@@ -30,10 +30,6 @@
 
 #include "same-inode.h"
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif
-
 #define ASSERT(expr) \
   do									     \
     {									     \
--- a/tests/test-fstatat.c
+++ b/tests/test-fstatat.c
@@ -31,10 +31,6 @@
 #include "pathmax.h"
 #include "same-inode.h"
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif
-
 #define ASSERT(expr) \
   do                                                                         \
     {                                                                        \
--- a/tests/test-lstat.c
+++ b/tests/test-lstat.c
@@ -29,10 +29,6 @@
 
 #include "same-inode.h"
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif
-
 #define ASSERT(expr) \
   do                                                                         \
     {                                                                        \
--- a/tests/test-remove.c
+++ b/tests/test-remove.c
@@ -27,10 +27,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif
-
 #define ASSERT(expr) \
   do                                                                         \
     {                                                                        \
--- a/tests/test-rmdir.c
+++ b/tests/test-rmdir.c
@@ -27,10 +27,6 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif
-
 #define ASSERT(expr) \
   do                                                                         \
     {                                                                        \
--- a/tests/test-unlink.c
+++ b/tests/test-unlink.c
@@ -30,10 +30,6 @@
 
 #include "unlinkdir.h"
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif
-
 #define ASSERT(expr) \
   do                                                                         \
     {                                                                        \
--- a/tests/test-unlinkat.c
+++ b/tests/test-unlinkat.c
@@ -29,10 +29,6 @@
 
 #include "unlinkdir.h"
 
-#if !HAVE_SYMLINK
-# define symlink(a,b) (-1)
-#endif
-
 #define ASSERT(expr) \
   do                                                                         \
     {                                                                        \