From: Matthew Dillon Date: Thu, 25 Mar 2010 17:35:43 +0000 (-0700) Subject: cpdup - Fix bug where cpdup sometimes does not remove files on target X-Git-Url: https://gitweb.dragonflybsd.org/~syl/dragonfly.git/commitdiff_plain/8ac50aa3da37c67bd7f34312e01d303b793d9ec9 cpdup - Fix bug where cpdup sometimes does not remove files on target * Fix a bug introduced in a recent commit which caused cpdup to sometimes not remove files on the target which were removed from the source. Submitted-by: Oliver Fromme --- diff --git a/bin/cpdup/cpdup.c b/bin/cpdup/cpdup.c index f4b3b900be..04b9754337 100644 --- a/bin/cpdup/cpdup.c +++ b/bin/cpdup/cpdup.c @@ -975,12 +975,13 @@ relink: if (!skipdir) { List *list = malloc(sizeof(List)); - Node *node = NULL; + Node *node; char *name; if (DirShowOpt) logstd("Scanning %s ...\n", spath); InitList(list); + node = NULL; if (ScanDir(list, &SrcHost, spath, &CountSourceReadBytes, 0) == 0) { while ((name = IterateList(list, &node, 0)) != NULL) { char *nspath; @@ -1010,7 +1011,8 @@ relink: * in the source. */ if (dpath && ScanDir(list, &DstHost, dpath, - &CountTargetReadBytes, 3) == 0) { + &CountTargetReadBytes, 3) == 0) { + node = NULL; while ((name = IterateList(list, &node, 3)) != NULL) { /* * If object does not exist in source or .cpignore