From 92ead9886c464bc88c5d9e5d2079e747d23a00b1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 25 Jun 2000 15:50:51 +0000 Subject: (copy_internal): Don't return return immediately after a failed copy_dir call -- 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. Reported by Piotr Kwapulinski. --- src/copy.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/copy.c b/src/copy.c index 8c0607f40..4e8b23c50 100644 --- a/src/copy.c +++ b/src/copy.c @@ -373,6 +373,7 @@ copy_internal (const char *src_path, const char *dst_path, int backup_succeeded = 0; int fix_mode = 0; int rename_errno; + int delayed_fail; if (move_mode && rename_succeeded) *rename_succeeded = 0; @@ -692,6 +693,7 @@ copy_internal (const char *src_path, const char *dst_path, } } + delayed_fail = 0; if (S_ISDIR (src_type)) { struct dir_list *dir; @@ -744,7 +746,12 @@ copy_internal (const char *src_path, const char *dst_path, if (copy_dir (src_path, dst_path, new_dst, &src_sb, dir, x, copy_into_self)) - return 1; + { + /* 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_fail = 1; + } } #ifdef S_ISLNK else if (x->symbolic_link) @@ -975,7 +982,7 @@ copy_internal (const char *src_path, const char *dst_path, } } - return 0; + return delayed_fail; un_backup: if (dst_backup) -- cgit v1.2.3-70-g09d2