fixed a race condition in the --delete handling code. The bug led to
[rsync/rsync.git] / flist.c
diff --git a/flist.c b/flist.c
index 01bcb29..5cf3044 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -163,7 +163,7 @@ void send_file_entry(struct file_struct *file,int f,unsigned base_flags)
   if (file->gid == last_gid) flags |= SAME_GID;
   if (file->modtime == last_time) flags |= SAME_TIME;
 
-  for (l1=0;lastname[l1] && fname[l1] == lastname[l1];l1++) ;
+  for (l1=0;lastname[l1] && (fname[l1] == lastname[l1]) && (l1 < 255);l1++) ;  
   l2 = strlen(fname) - l1;
 
   if (l1 > 0) flags |= SAME_NAME;
@@ -513,7 +513,7 @@ static void send_directory(int f,struct file_list *flist,char *dir)
        d = opendir(dir);
        if (!d) {
                io_error = 1;
-               rprintf(FERROR,"%s: %s\n",
+               rprintf(FERROR,"opendir(%s): %s\n",
                        dir,strerror(errno));
                return;
        }
@@ -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);