From e1ad7fe63d98b4aace63a0f1ab502db8e88063f6 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 22 Feb 2005 00:42:12 +0000 Subject: [PATCH] A couple changes in delete_file() make us more compatible with older versions: (1) we no longer complain if excluded files sticking around cause us to not be able to remove a subdir, and (2) we output the name of the removed subdir after it has been successfully removed. --- flist.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/flist.c b/flist.c index a97eb79c..21fe9f49 100644 --- a/flist.c +++ b/flist.c @@ -1828,19 +1828,11 @@ int delete_file(char *fname, int mode, int flags) return -1; } - if (!(flags & DEL_TERSE)) { - if (verbose || log_format) - log_delete(fname, mode); - flags |= DEL_TERSE; - } - dirlist = get_dirlist(fname, 0); for (j = 0; j < dirlist->count; j++) { struct file_struct *fp = dirlist->files[j]; f_name_to(fp, buf); - if (verbose || log_format) - log_delete(buf, fp->mode); - if (delete_file(buf, fp->mode, flags) != 0) { + if (delete_file(buf, fp->mode, flags & ~DEL_TERSE) != 0) { flist_free(dirlist); return -1; } @@ -1854,13 +1846,16 @@ int delete_file(char *fname, int mode, int flags) ok = make_backup(fname); else ok = do_rmdir(fname) == 0; - if (!ok && errno != ENOENT) { + if (ok) { + if ((verbose || log_format) && !(flags & DEL_TERSE)) + log_delete(fname, mode); + deletion_count++; + } else if (errno != ENOTEMPTY && errno != ENOENT) { rsyserr(FERROR, errno, "delete_file: rmdir %s failed", full_fname(fname)); return -1; } - deletion_count++; return 0; } -- 2.34.1