summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/chown-core.c2
-rwxr-xr-xtests/chgrp/posix-H4
3 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 021f69276..1ca6b4490 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2006-10-13 Jim Meyering <jim@meyering.net>
+ * src/chown-core.c (change_file_owner): Use fstatat, not stat,
+ now that we're using fts_open with FTS_CWDFD.
+ * tests/chgrp/posix-H: Add --preserve-root to an invocation of
+ chgrp, to exercise the above fix.
+
* src/du-tests: Clean up a little, though it's still not portable.
* .vg-suppressions: Add 3 more for debian unstable.
diff --git a/src/chown-core.c b/src/chown-core.c
index dbd3e52d8..d1efe52b6 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -318,7 +318,7 @@ change_file_owner (FTS *fts, FTSENT *ent,
stat it to get info on the referent. */
if (S_ISLNK (file_stats->st_mode) && chopt->affect_symlink_referent)
{
- if (stat (file, &stat_buf) != 0)
+ if (fstatat (fts->fts_cwd_fd, file, &stat_buf, 0) != 0)
{
error (0, errno, _("cannot dereference %s"),
quote (file_full_name));
diff --git a/tests/chgrp/posix-H b/tests/chgrp/posix-H
index 147bb5224..907b7da5e 100755
--- a/tests/chgrp/posix-H
+++ b/tests/chgrp/posix-H
@@ -1,7 +1,7 @@
#!/bin/sh
# Test POSIX-mandated -H option.
-# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 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 @@ fi
fail=0
-chgrp -H -R $g2 1s 2 || fail=1
+chgrp --preserve-root -H -R $g2 1s 2 || fail=1
# These must have group $g2.
# =========================