summaryrefslogtreecommitdiff
path: root/tests/chown
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-10-13 21:11:53 +0000
committerJim Meyering <jim@meyering.net>2006-10-13 21:11:53 +0000
commit965232b5b9899e1939029c448d3870d92f35d1db (patch)
tree5eb77136a45586ce600f9d93c0b51e1e17260f8c /tests/chown
parent5dea5d07cdad67d8ca1ce90eef9dc7847c057c02 (diff)
downloadcoreutils-965232b5b9899e1939029c448d3870d92f35d1db.tar.xz
More chown/chgrp dereferencing-related fixes.
* src/chown-core.c (change_file_owner): Don't use fts_statp if we're dereferencing symlinks. Reverse conjuncts, so that we use dereference file_stats (aka ent->fts_statp) only *after* we've confirmed that chopt->affect_symlink_referent is true. Otherwise, we might use ent->fts_statp uninitialized. Don't turn on FTS_NOSTAT when dereferencing symlinks. * tests/chown/deref: Update the expected diagnostic, now that this test case (trying to use "chown --dereference ..." on a dangling symlink) takes a different code path.
Diffstat (limited to 'tests/chown')
-rwxr-xr-xtests/chown/deref4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/chown/deref b/tests/chown/deref
index 2c7facd74..dc912533b 100755
--- a/tests/chown/deref
+++ b/tests/chown/deref
@@ -2,7 +2,7 @@
# For coreutils-5.2.1 and earlier, chown --dereference would skip
# symlinks having owner/group matching the specified owner/group.
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ chown --dereference $user dangle 2> out1 && fail=1
sed 's/: [^:]*$//' out1 > out
cat <<\EOF > exp || fail=1
-chown: changing ownership of `dangle'
+chown: cannot dereference `dangle'
EOF
cmp out exp || fail=1