From 7b1ce0d746df0d7f7f33238799949ff3cec911a2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 27 May 1998 06:30:50 +0000 Subject: [PATCH] fixed a race condition in the --delete handling code. The bug led to spurious error messages about not be able to delete some files. this fix also makes --delete processing more efficient --- flist.c | 2 +- rsync.c | 6 ++++-- rsync.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/flist.c b/flist.c index a185082b..5cf30446 100644 --- a/flist.c +++ b/flist.c @@ -548,7 +548,7 @@ static void send_directory(int f,struct file_list *flist,char *dir) strcmp(dname,"..")==0) continue; strlcpy(p,dname,MAXPATHLEN-(l+1)); - send_file_name(f,flist,fname,recurse,FLAG_DELETE); + send_file_name(f,flist,fname,recurse,0); } closedir(d); diff --git a/rsync.c b/rsync.c index 2f772ace..1621995b 100644 --- a/rsync.c +++ b/rsync.c @@ -696,7 +696,8 @@ static void delete_files(struct file_list *flist) if (!S_ISDIR(flist->files[j]->mode) || !(flist->files[j]->flags & FLAG_DELETE)) continue; - if (delete_already_done(flist, j)) continue; + if (remote_version < 19 && + delete_already_done(flist, j)) continue; name = strdup(f_name(flist->files[j])); @@ -710,7 +711,8 @@ static void delete_files(struct file_list *flist) for (i=local_file_list->count-1;i>=0;i--) { if (!local_file_list->files[i]->basename) continue; - if (S_ISDIR(local_file_list->files[i]->mode)) + if (remote_version < 19 && + S_ISDIR(local_file_list->files[i]->mode)) add_delete_entry(local_file_list->files[i]); if (-1 == flist_find(flist,local_file_list->files[i])) { delete_one(local_file_list->files[i]); diff --git a/rsync.h b/rsync.h index 7e2967b7..877ce049 100644 --- a/rsync.h +++ b/rsync.h @@ -41,7 +41,7 @@ #define SAME_TIME (1<<7) /* update this if you make incompatible changes */ -#define PROTOCOL_VERSION 18 +#define PROTOCOL_VERSION 19 #define MIN_PROTOCOL_VERSION 11 #define MAX_PROTOCOL_VERSION 30 -- 2.34.1