From 85fdb784f964cda60f6cbb32d86e9137be059626 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 23 Aug 2022 08:29:54 +0200 Subject: [PATCH] Remove replaced directory even without --delete When a directory is replaced by another type (e.g. a plain file), it is first renamed and later removed. This later removal should be done regardless of whether --delete was selected or not. --- cmirror.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmirror.c b/cmirror.c index 55f89e1..987d3e4 100644 --- a/cmirror.c +++ b/cmirror.c @@ -913,18 +913,19 @@ static void slave(char *slave_path) { fileop_rm(path); } } - GSList *d = CLEAN_DIRS; - while (d) { - char *path = (char *)d->data; - if (!quiet) - warn("rm -r %s\n", path); - fileop_rmdir_recurse(path); - d = d->next; - } } if (reduce) return; + GSList *d = CLEAN_DIRS; + while (d) { + char *path = (char *)d->data; + if (!quiet) + warn("rm -r %s\n", path); + fileop_rmdir_recurse(path); + d = d->next; + } + DIR_MTIME_QUEUE = g_list_reverse(DIR_MTIME_QUEUE); for (GList *e = DIR_MTIME_QUEUE ; e != NULL ; e = e->next ) { DirMtime *mt = e->data;