X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=m4%2Fchown.m4;h=fa46981b2274e8277036e00c1313d6bb1db926df;hb=21d1619b3010053ebe4d4eae33440f7141ae2413;hp=8c3ae55730522a999997daee3525a50160c6a8b3;hpb=441aa3044f43e5572f58c354f01e6bc070acd5c7;p=gnulib.git diff --git a/m4/chown.m4 b/m4/chown.m4 index 8c3ae5573..fa46981b2 100644 --- a/m4/chown.m4 +++ b/m4/chown.m4 @@ -1,8 +1,8 @@ -# serial 22 +# serial 25 # Determine whether we need the chown wrapper. -dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009 -dnl Free Software Foundation, Inc. +dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2011 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,12 +25,10 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN], dnl mingw lacks chown altogether. if test $ac_cv_func_chown = no; then HAVE_CHOWN=0 - AC_LIBOBJ([chown]) else dnl Some old systems treated chown like lchown. if test $gl_cv_func_chown_follows_symlink = no; then REPLACE_CHOWN=1 - AC_LIBOBJ([chown]) fi dnl Some old systems tried to use uid/gid -1 literally. @@ -38,11 +36,11 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN], AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1], [Define if chown is not POSIX compliant regarding IDs of -1.]) REPLACE_CHOWN=1 - AC_LIBOBJ([chown]) fi dnl Solaris 9 ignores trailing slash. dnl FreeBSD 7.2 mishandles trailing slash on symlinks. + dnl Likewise for AIX 7.1. AC_CACHE_CHECK([whether chown honors trailing slash], [gl_cv_func_chown_slash_works], [touch conftest.file && rm -f conftest.link @@ -61,7 +59,6 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN], AC_DEFINE([CHOWN_TRAILING_SLASH_BUG], [1], [Define to 1 if chown mishandles trailing slash.]) REPLACE_CHOWN=1 - AC_LIBOBJ([chown]) fi dnl OpenBSD fails to update ctime if ownership does not change. @@ -89,11 +86,6 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN], AC_DEFINE([CHOWN_CHANGE_TIME_BUG], [1], [Define to 1 if chown fails to change ctime when at least one argument was not -1.]) REPLACE_CHOWN=1 - AC_LIBOBJ([chown]) - fi - - if test $REPLACE_CHOWN = 1 && test $ac_cv_func_fchown = no; then - AC_LIBOBJ([fchown-stub]) fi fi ]) @@ -113,6 +105,7 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK], int main () { + int result = 0; char const *dangling_symlink = "conftest.dangle"; unlink (dangling_symlink); @@ -121,8 +114,11 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK], /* Exit successfully on a conforming system, i.e., where chown must fail with ENOENT. */ - exit ( ! (chown (dangling_symlink, getuid (), getgid ()) != 0 - && errno == ENOENT)); + if (chown (dangling_symlink, getuid (), getgid ()) == 0) + result |= 1; + if (errno != ENOENT) + result |= 2; + return result; } ]])], [gl_cv_func_chown_follows_symlink=yes],