unlinkat(fd,"file/",0) mistakenly succeeded.
* m4/openat.m4 (gl_FUNC_OPENAT): Replace unlinkat if unlink is
broken.
* doc/posix-functions/unlink.texi (unlink): Document this.
* doc/posix-functions/unlinkat.texi (unlinkat): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2009-10-06 Eric Blake <ebb9@byu.net>
+ openat: fix GNU/Hurd bug in unlinkat
+ * m4/openat.m4 (gl_FUNC_OPENAT): Replace unlinkat if unlink is
+ broken.
+ * doc/posix-functions/unlink.texi (unlink): Document this.
+ * doc/posix-functions/unlinkat.texi (unlinkat): Likewise.
+
fdopendir: fix GNU/Hurd bug
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Check for Hurd bug in
allowing non-directory fds.
@itemize
@item
Some systems mistakenly succeed on @code{unlink("file/")}:
-Solaris 9.
+GNU/Hurd, Solaris 9.
@end itemize
Portability problems not fixed by Gnulib:
But the replacement function is not safe to be used in libraries and is not multithread-safe.
@item
Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}:
-Solaris 9.
+GNU/Hurd, Solaris 9.
@end itemize
Portability problems not fixed by Gnulib:
-# serial 24
+# serial 25
# See if we need to use our replacement for Solaris' openat et al functions.
dnl Copyright (C) 2004-2009 Free Software Foundation, Inc.
AC_CHECK_FUNCS_ONCE([lchmod])
AC_REPLACE_FUNCS([fchmodat fstatat mkdirat openat unlinkat])
AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+ AC_REQUIRE([gl_FUNC_UNLINK])
case $ac_cv_func_openat+$ac_cv_func_lstat_dereferences_slashed_symlink in
- yes+yes) ;;
+ yes+yes)
+ # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+ if test $REPLACE_UNLINK = 1; then
+ AC_LIBOBJ([unlinkat])
+ REPLACE_UNLINKAT=1
+ fi ;;
yes+*)
# Solaris 9 has *at functions, but uniformly mishandles trailing
# slash in all of them.