fixed a bug in the handling of -R with --delete
authorAndrew Tridgell <tridge@samba.org>
Mon, 13 Apr 1998 06:39:33 +0000 (06:39 +0000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 13 Apr 1998 06:39:33 +0000 (06:39 +0000)
I introduced this bug in the last version as a side effect of fixing
the permissions on intermediate directories with -R. drat.

rsync.c

diff --git a/rsync.c b/rsync.c
index e359adc793eb811a0c97bf5eeda6d3899ca1900d..c1ce0b5c85f514594eac57258dcd90adcc610cdf 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -649,6 +649,8 @@ static int delete_already_done(struct file_list *flist,int j)
                exit_cleanup(1);
        }
 
+       name[strlen(name)-2] = 0;
+
        p = strrchr(name,'/');
        if (!p) {
                free(name);
@@ -656,6 +658,8 @@ static int delete_already_done(struct file_list *flist,int j)
        }
        *p = 0;
 
+       strcat(name,"/.");
+
        while (low != high) {
                int mid = (low+high)/2;
                int ret = strcmp(f_name(flist->files[flist_up(flist, mid)]),name);
@@ -703,6 +707,8 @@ static void delete_files(struct file_list *flist)
 
          if (!S_ISDIR(flist->files[j]->mode)) continue;
 
+         if (strlen(name)<2 || strcmp(name+strlen(name)-2,"/.")!=0) continue;
+
          if (delete_already_done(flist, j)) continue;
 
          if (!(local_file_list = send_file_list(-1,1,&name)))