X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fchown.m4;h=f664e7c57f85cbdde67bbd7a5e02f01aa29bfc49;hb=4c55ba7831f4ce8d3c7addcb20be418330a22239;hp=0dced4bce06a348ce963ca117a94a789f8f40e8f;hpb=84405cbc35207f178b1b50617254cb85ea803128;p=gnulib.git diff --git a/m4/chown.m4 b/m4/chown.m4 index 0dced4bce..f664e7c57 100644 --- a/m4/chown.m4 +++ b/m4/chown.m4 @@ -1,8 +1,8 @@ -# serial 22 +# serial 24 # 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, @@ -43,6 +43,7 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN], 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 @@ -110,24 +111,28 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK], #include #include - int - main () - { - char const *dangling_symlink = "conftest.dangle"; + int + main () + { + int result = 0; + char const *dangling_symlink = "conftest.dangle"; - unlink (dangling_symlink); - if (symlink ("conftest.no-such", dangling_symlink)) - abort (); + unlink (dangling_symlink); + if (symlink ("conftest.no-such", dangling_symlink)) + abort (); - /* Exit successfully on a conforming system, - i.e., where chown must fail with ENOENT. */ - exit ( ! (chown (dangling_symlink, getuid (), getgid ()) != 0 - && errno == ENOENT)); - } - ]])], - [gl_cv_func_chown_follows_symlink=yes], - [gl_cv_func_chown_follows_symlink=no], - [gl_cv_func_chown_follows_symlink=yes] + /* Exit successfully on a conforming system, + i.e., where chown must fail with ENOENT. */ + if (chown (dangling_symlink, getuid (), getgid ()) == 0) + result |= 1; + if (errno != ENOENT) + result |= 2; + return result; + } + ]])], + [gl_cv_func_chown_follows_symlink=yes], + [gl_cv_func_chown_follows_symlink=no], + [gl_cv_func_chown_follows_symlink=yes] ) ] )