summaryrefslogtreecommitdiff
path: root/src/chown-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chown-core.c')
-rw-r--r--src/chown-core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/chown-core.c b/src/chown-core.c
index 8a0d51dfa..69345ccf8 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -337,7 +337,12 @@ change_file_owner (FTS *fts, FTSENT *ent,
|| required_gid == file_stats->st_gid));
}
- if (do_chown && ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats))
+ if (do_chown
+ /* With FTS_NOSTAT, file_stats is valid only for directories.
+ Don't need to check for FTS_D, since it is handled above,
+ and same for FTS_DNR, since then do_chown is false. */
+ && (ent->fts_info == FTS_DP || ent->fts_info == FTS_DC)
+ && ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats))
{
ROOT_DEV_INO_WARN (file_full_name);
ok = do_chown = false;
@@ -457,7 +462,7 @@ chown_files (char **files, int bit_flags,
/* Use lstat and stat only if they're needed. */
int stat_flags = ((required_uid != (uid_t) -1 || required_gid != (gid_t) -1
|| chopt->affect_symlink_referent
- || chopt->verbosity != V_off || chopt->root_dev_ino)
+ || chopt->verbosity != V_off)
? 0
: FTS_NOSTAT);