I noticed that cpdup sometimes doesn't remove files on the
target that were removed on the source.  This is caused by
a failure to reset the "node" variable to NULL in cpdup.c.

This bug was accidentally introduced in cpdup v1.16 by me
when I wrote the ScanDir() and IterateList() functions.
I'm very sorry for that.

Please apply the patch below.  It fixes the problem.

Best regards
   Oliver

--- cpdup/cpdup.c.orig  2009-12-03 21:55:22.000000000 +0100
+++ cpdup/cpdup.c       2010-03-25 12:24:55.000000000 +0100
@@ -975,12 +975,13 @@
 
        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;
@@ -1011,6 +1012,7 @@
                 */
                if (dpath && ScanDir(list, &DstHost, dpath,
                        &CountTargetReadBytes, 3) == 0) {
+                   node = NULL;
                    while ((name = IterateList(list, &node, 3)) != NULL) {
                        /*
                         * If object does not exist in source or .cpignore

Reply via email to