X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvclone.c;fp=src%2Fvclone.c;h=a9d2b2e87c768bc1de968cf7af71af8b77ec58db;hb=06f0081406da031cdcaf12064fcc988e27990b0f;hp=26d70dd5d5d436a6e2e141512f785dde6fc54340;hpb=270eb3149abb037fcf5e88e53d8a8ec09ad5444b;p=util-vserver.git diff --git a/src/vclone.c b/src/vclone.c index 26d70dd..a9d2b2e 100644 --- a/src/vclone.c +++ b/src/vclone.c @@ -132,7 +132,11 @@ visitDirEntry(struct dirent const *ent) char dst_path_buf[ENSC_PI_APPSZ(dst_path, src_path)]; PathInfo_append(&dst_path, &src_path, dst_path_buf); - if (S_ISREG(f_stat.st_mode) && Unify_isIUnlinkable(src_d_path.d) == unifyBUSY) { + + /* skip files that already exist */ + if (access(dst_path.d, F_OK)!=-1) + res = 0; + else if (S_ISREG(f_stat.st_mode) && Unify_isIUnlinkable(src_d_path.d) == unifyBUSY) { Elink(src_d_path.d, dst_path.d); res = 0; } @@ -141,11 +145,10 @@ visitDirEntry(struct dirent const *ent) perror(ENSC_WRAPPERS_PREFIX "Unify_copy()"); exit(wrapper_exit_code); } - if (S_ISDIR(f_stat.st_mode)) - res = visitDir(dirname, &f_stat); - else - res = 0; + res = 0; } + if (S_ISDIR(f_stat.st_mode)) + res = visitDir(dirname, &f_stat); } return res;