summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-05-01 06:48:55 +0000
committerJim Meyering <jim@meyering.net>2004-05-01 06:48:55 +0000
commit27b510575d4d22104ca18a0ee8430e52f0a792c9 (patch)
treeb697edc7c5f3a75c50e9d2dc64fb685f61d40775 /src
parent70b9c509035cef7b49f68de34d9c7d4bef285907 (diff)
downloadcoreutils-27b510575d4d22104ca18a0ee8430e52f0a792c9.tar.xz
(change_file_owner): Add a comment.
Diffstat (limited to 'src')
-rw-r--r--src/chown-core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/chown-core.c b/src/chown-core.c
index 5df0c1860..821adfe76 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -226,6 +226,16 @@ change_file_owner (FTS *fts, FTSENT *ent,
/* Applying chown to a symlink and expecting it to affect
the referent is not portable. So instead, open the
file and use fchown on the resulting descriptor. */
+ /* FIXME: but on some systems (e.g. Linux-2.1.81 and newer),
+ using chown is much better, since it *does* follow
+ symlinks, and the open/fchown approach fails when
+ the file is not readable. This looks like a fine case
+ for another chown wrapper. In any case, this code can
+ clobber errno, so fix it or remove it.
+ Related: with a proper autoconf test -- is this possible,
+ without root permissions or a guarantee of more than
+ one group? -- the lchown wrapper may just end up
+ calling chown on some systems. */
int fd = open (file, O_RDONLY | O_NONBLOCK | O_NOCTTY);
fail = (fd == -1 ? 1 : fchown (fd, new_uid, new_gid));
if (fd != -1)