diff options
author | Jim Meyering <jim@meyering.net> | 2000-06-25 15:50:51 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-06-25 15:50:51 +0000 |
commit | 92ead9886c464bc88c5d9e5d2079e747d23a00b1 (patch) | |
tree | b6153dc38989209cb8fdc2202d500c499df60b5a /src | |
parent | 8a900584f1e25d2bd47153548af51bfdaa5245cd (diff) | |
download | coreutils-92ead9886c464bc88c5d9e5d2079e747d23a00b1.tar.xz |
(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.
Diffstat (limited to 'src')
-rw-r--r-- | src/copy.c | 11 |
1 files changed, 9 insertions, 2 deletions
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) |