From: Bruno Haible Date: Sat, 20 Mar 2010 16:48:19 +0000 (+0100) Subject: Fix last commit. X-Git-Tag: v0.1~4468 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=c861b874f3926ab75f12d66ea194a60775b83fc9;p=gnulib.git Fix last commit. --- diff --git a/ChangeLog b/ChangeLog index 94e90f0f1..cc3ef5aa3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-03-20 Bruno Haible + * m4/unlink.m4 (gl_FUNC_UNLINK): Fix last commit. + Reported by Jim Meyering. + +2010-03-20 Bruno Haible + pipe: Set errno upon failure. * lib/pipe.h: Specify that when -1 is returned, errno is set. * lib/pipe.c (create_pipe): Set errno when returning -1. Use the right diff --git a/m4/unlink.m4 b/m4/unlink.m4 index 01f2aabf4..2eef4f08b 100644 --- a/m4/unlink.m4 +++ b/m4/unlink.m4 @@ -36,6 +36,11 @@ AC_DEFUN([gl_FUNC_UNLINK], [gl_cv_func_unlink_parent_fails], [case "$host_os" in darwin*) + dnl Try to unlink a subdirectory of /tmp, because /tmp is usually on a + dnl HFS mount on MacOS X. Use a subdirectory, owned by the current + dnl user, because otherwise unlink() may fail due to permissions + dnl reasons, and because when running as root we don't want to risk + dnl destroying the entire /tmp. if { # Use the mktemp program if available. If not available, hide the error # message. @@ -52,14 +57,15 @@ AC_DEFUN([gl_FUNC_UNLINK], (umask 077 && mkdir "$tmp") }; then mkdir "$tmp/subdir" - export tmp + GL_SUBDIR_FOR_UNLINK="$tmp/subdir" + export GL_SUBDIR_FOR_UNLINK AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include #include int main () { - if (chdir (getenv ("tmp")) != 0) + if (chdir (getenv ("GL_SUBDIR_FOR_UNLINK")) != 0) return 1; return unlink ("..") == 0; } @@ -67,8 +73,8 @@ AC_DEFUN([gl_FUNC_UNLINK], [gl_cv_func_unlink_parent_fails=yes], [gl_cv_func_unlink_parent_fails=no], [gl_cv_func_unlink_parent_fails="guessing no"]) + unset GL_SUBDIR_FOR_UNLINK rm -rf "$tmp" - unset tmp else gl_cv_func_unlink_parent_fails="guessing no" fi