summaryrefslogtreecommitdiff
path: root/src/copy.c
diff options
context:
space:
mode:
authorAndrew Church <achurch@achurch.org>2007-03-03 23:00:18 +0100
committerJim Meyering <jim@meyering.net>2007-03-03 23:00:18 +0100
commit2871ad3b45ed1b1f44be57fd453cf9a50a4c5af7 (patch)
treee96f3a0493c5c82691063e8ad8855fa56b06fd52 /src/copy.c
parentf0537a71f1e414ceb7ecaa7f872b73b401209082 (diff)
downloadcoreutils-2871ad3b45ed1b1f44be57fd453cf9a50a4c5af7.tar.xz
Fix a bug: cp -x would fail to set mount point permissions.
* NEWS: mention cp -x bug fix * src/copy.c (copy_internal): Don't return immediately after copying a mount point that we do not intend to recurse under. Based on a patch by Andrew Church.
Diffstat (limited to 'src/copy.c')
-rw-r--r--src/copy.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/copy.c b/src/copy.c
index 000c248eb..49bbb8ce4 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1604,19 +1604,20 @@ copy_internal (char const *src_name, char const *dst_name,
emit_verbose (src_name, dst_name, NULL);
}
- /* Are we crossing a file system boundary? */
+ /* Decide whether to copy the contents of the directory. */
if (x->one_file_system && device != 0 && device != src_sb.st_dev)
- return true;
-
- /* Copy the contents of the directory. */
-
- if (! copy_dir (src_name, dst_name, new_dst, &src_sb, dir, x,
- copy_into_self))
{
- /* Don't just return here -- otherwise, the failure to read a
- single file in a source directory would cause the containing
- destination directory not to have owner/perms set properly. */
- delayed_ok = false;
+ /* Here, we are crossing a file system boundary and cp's -x option
+ is in effect: so don't copy the contents of this directory. */
+ }
+ else
+ {
+ /* Copy the contents of the directory. Don't just return if
+ this fails -- otherwise, the failure to read a single file
+ in a source directory would cause the containing destination
+ directory not to have owner/perms set properly. */
+ delayed_ok = copy_dir (src_name, dst_name, new_dst, &src_sb, dir, x,
+ copy_into_self);
}
}
else if (x->symbolic_link)