diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/chown-core.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/chown-core.c b/src/chown-core.c index b39061091..bd987a8c1 100644 --- a/src/chown-core.c +++ b/src/chown-core.c @@ -1,5 +1,5 @@ /* chown-core.c -- core functions for changing ownership. - Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation. + Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation. 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 @@ -32,6 +32,12 @@ #include "root-dev-ino.h" #include "xfts.h" +#define FTSENT_IS_DIRECTORY(E) \ + ((E)->fts_info == FTS_D \ + || (E)->fts_info == FTS_DC \ + || (E)->fts_info == FTS_DP \ + || (E)->fts_info == FTS_DNR) + enum RCH_status { /* we called fchown and close, and both succeeded */ @@ -351,7 +357,9 @@ change_file_owner (FTS *fts, FTSENT *ent, } /* This happens when chown -LR --preserve-root encounters a symlink-to-/. */ - if (ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats)) + if (ok + && FTSENT_IS_DIRECTORY (ent) + && ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats)) { ROOT_DEV_INO_WARN (file_full_name); return false; |