X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fvunify.c;h=0c98af41251558058ac57c707c63b3f37a5d4da8;hb=557d2996ed86689c11dcf0b528dc0b254e9b76d2;hp=f5f1ed1f312e3aed6d955a51d39f91c0d2710372;hpb=d1f6700736a2d4a29515e883ddd741b0580ec066;p=util-vserver.git diff --git a/util-vserver/src/vunify.c b/util-vserver/src/vunify.c index f5f1ed1..0c98af4 100644 --- a/util-vserver/src/vunify.c +++ b/util-vserver/src/vunify.c @@ -131,26 +131,25 @@ checkFstat(struct MatchList const * const mlist, } assert(*dst_fstat!=0); + - { - PathInfo src_path = mlist->root; - char src_path_buf[ENSC_PI_APPSZ(src_path, *path)]; + PathInfo src_path = mlist->root; + char src_path_buf[ENSC_PI_APPSZ(src_path, *path)]; - PathInfo_append(&src_path, path, src_path_buf); + PathInfo_append(&src_path, path, src_path_buf); // source file does not exist - skip_reason.r = rsNOEXISTS; - if (lstat(src_path.d, src_fstat)==-1) return false; + skip_reason.r = rsNOEXISTS; + if (lstat(src_path.d, src_fstat)==-1) return false; // these are directories; this succeeds everytime - if (S_ISDIR((*dst_fstat)->st_mode) && S_ISDIR(src_fstat->st_mode)) return true; + if (S_ISDIR((*dst_fstat)->st_mode) && S_ISDIR(src_fstat->st_mode)) return true; // both files are different, so return false - skip_reason.r = rsDIFFERENT; - if ((!global_args->do_revert && !Unify_isUnifyable(*dst_fstat, src_fstat)) || - ( global_args->do_revert && !Unify_isUnified (*dst_fstat, src_fstat))) - return false; - } + skip_reason.r = rsDIFFERENT; + if ((!global_args->do_revert && !Unify_isUnifyable(*dst_fstat, src_fstat)) || + ( global_args->do_revert && !Unify_isUnified (*dst_fstat, src_fstat))) + return false; // these are the same files return true; @@ -169,7 +168,7 @@ checkDirEntry(PathInfo const *path, // abort when it is not matching an allowed entry skip_reason.r = rsEXCL_DST; skip_reason.d.list = &info->dst_list; - if (!MatchList_compare(&info->dst_list, path->d)) return 0; + if (MatchList_compare(&info->dst_list, path->d)!=stINCLUDE) return 0; // Now, go through the reference vservers and do the lightweigt list-check // first and compare then the fstat's. @@ -177,7 +176,7 @@ checkDirEntry(PathInfo const *path, cache_stat = 0; skip_reason.r = rsEXCL_SRC; skip_reason.d.list = mlist; - if (MatchList_compare(mlist, path->d) && + if (MatchList_compare(mlist, path->d)==stINCLUDE && checkFstat(mlist, d_path, path, &cache_stat, dst_stat, src_stat)) { // Failed the check or is it a symlink which can not be handled @@ -252,15 +251,15 @@ doit(struct MatchList const *mlist, if (global_args->do_revert) WRITE_MSG(1, "deunifying '"); else WRITE_MSG(1, "unifying '"); - write(1, src_path->d, src_path->l); + Vwrite(1, src_path->d, src_path->l); WRITE_MSG(1, "'"); if (Global_getVerbosity()>=4) { WRITE_MSG(1, " (from "); if (Global_getVerbosity()==4 && mlist->id.d) - write(1, mlist->id.d, mlist->id.l); + Vwrite(1, mlist->id.d, mlist->id.l); else - write(1, mlist->root.d, mlist->root.l); + Vwrite(1, mlist->root.d, mlist->root.l); WRITE_MSG(1, ")"); } WRITE_MSG(1, "\n"); @@ -268,7 +267,7 @@ doit(struct MatchList const *mlist, PathInfo_append(&path, src_path, path_buf); return (global_args->do_dry_run || - (!global_args->do_revert && Unify_unify (path.d, src_stat, dst_path)) || + (!global_args->do_revert && Unify_unify (path.d, src_stat, dst_path, false)) || ( global_args->do_revert && Unify_deUnify(dst_path))); } @@ -285,7 +284,7 @@ printSkipReason() MatchList_printId(skip_reason.d.list, 1); break; case rsFSTAT : WRITE_MSG(1, "fstat error"); break; - case rsNOEXISTS : WRITE_MSG(1, "does not exists in refserver(s)"); break; + case rsNOEXISTS : WRITE_MSG(1, "does not exist in refserver(s)"); break; case rsSYMLINK : WRITE_MSG(1, "symlink"); break; case rsSPECIAL : WRITE_MSG(1, "non regular file"); break; case rsUNIFIED : WRITE_MSG(1, "already unified"); break; @@ -329,7 +328,7 @@ visitDirEntry(struct dirent const *ent) (Global_getVerbosity()>=6 && is_dotfile) || (Global_getVerbosity()>=6 && is_link)) ) { WRITE_MSG(1, " skipping '"); - write(1, path.d, path.l); + Vwrite(1, path.d, path.l); WRITE_MSG(1, "'"); if (Global_getVerbosity()>=2) printSkipReason(); WRITE_MSG(1, "\n");