diff options
author | Eric Blake <ebb9@byu.net> | 2009-11-12 21:45:20 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-11-14 10:34:11 -0700 |
commit | 6bd102382341d268d2e99349abd4c21546a5993e (patch) | |
tree | 370475caec669fb4ba3a31d2957b3d811ae977ed /m4/lchown.m4 | |
parent | 9cd8acbae7f8ca3985001de0752b22e2a28d0cd7 (diff) | |
download | gnulib-6bd102382341d268d2e99349abd4c21546a5993e.tar.gz |
lchown: detect Solaris and FreeBSD bug
Solaris 9 and FreeBSD 7.2 lchown("link-to-file/",uid,gid)
mistakenly changes ownership of "file".
* lib/lchown.c (rpl_lchown): Work around bug.
* m4/lchown.m4 (gl_FUNC_LCHOWN): Check for trailing slash bugs.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Populate it.
* lib/unistd.in.h (lchown): Update declaration.
* doc/posix-functions/lchown.texi (lchown): Document the bug.
* modules/lchown-tests: New file.
* tests/test-lchown.h (test_lchown): Likewise.
* tests/test-lchown.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'm4/lchown.m4')
-rw-r--r-- | m4/lchown.m4 | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/m4/lchown.m4 b/m4/lchown.m4 index f509fde04a..e40c437626 100644 --- a/m4/lchown.m4 +++ b/m4/lchown.m4 @@ -1,14 +1,16 @@ -# serial 13 +# serial 14 # Determine whether we need the lchown wrapper. -dnl Copyright (C) 1998, 2001, 2003-2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1998, 2001, 2003-2007, 2009 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, dnl with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. -dnl Provide lchown on systems that lack it. +dnl Provide lchown on systems that lack it, and work around trailing +dnl slash bugs on systems that have it. AC_DEFUN([gl_FUNC_LCHOWN], [ @@ -16,6 +18,10 @@ AC_DEFUN([gl_FUNC_LCHOWN], AC_REQUIRE([gl_FUNC_CHOWN]) AC_REPLACE_FUNCS([lchown]) if test $ac_cv_func_lchown = no; then + HAVE_LCHOWN=0 + elif test "$gl_cv_func_chown_slash_works" != yes; then + dnl Trailing slash bugs in chown also occur in lchown. + AC_LIBOBJ([lchown]) REPLACE_LCHOWN=1 fi ]) |