chown: detect Solaris and FreeBSD bug
authorEric Blake <ebb9@byu.net>
Fri, 13 Nov 2009 04:45:20 +0000 (21:45 -0700)
committerEric Blake <ebb9@byu.net>
Sat, 14 Nov 2009 17:33:28 +0000 (10:33 -0700)
commit9cd8acbae7f8ca3985001de0752b22e2a28d0cd7
treee4e6533b153eb4537063a328635b014719e6bd4e
parentfb1b608caaa3de195f3d97356e95a165ef5517da
chown: detect Solaris and FreeBSD bug

Solaris 9 and FreeBSD 7.2 chown("link-to-file/",uid,gid)
mistakenly changes ownership of "file".

* lib/chown.c (rpl_chown): Work around bug.
* m4/chown.m4 (gl_FUNC_CHOWN): Check for trailing slash bugs.
(gl_PREREQ_CHOWN): Delete.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Populate it.
* lib/unistd.in.h (chown): Update declaration.
* lib/lchown.c (chown): Update client.
* modules/lchown (Depends-on): Add lstat.
* doc/posix-functions/chown.texi (chown): Document the bug.
* doc/posix-functions/getgroups.texi (getgroups): Document
getgroups pitfall.
* modules/chown-tests: New file.
* tests/test-chown.h (test_chown): Likewise.
* tests/test-chown.c (main): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
13 files changed:
ChangeLog
doc/posix-functions/chown.texi
doc/posix-functions/getgroups.texi
lib/chown.c
lib/lchown.c
lib/unistd.in.h
m4/chown.m4
m4/unistd_h.m4
modules/chown-tests [new file with mode: 0644]
modules/lchown
modules/unistd
tests/test-chown.c [new file with mode: 0644]
tests/test-chown.h [new file with mode: 0644]