Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
some large systematic changes to make socket conversion easier. The
[rsync/rsync.git]
/
rsync.c
diff --git
a/rsync.c
b/rsync.c
index
16a7a31
..
9d3b1c5
100644
(file)
--- a/
rsync.c
+++ b/
rsync.c
@@
-83,25
+83,25
@@
static int delete_file(char *fname)
ret = do_stat(fname, &st);
#endif
if (ret) {
ret = do_stat(fname, &st);
#endif
if (ret) {
-
f
printf(FERROR,"stat(%s) : %s\n", fname, strerror(errno));
+
r
printf(FERROR,"stat(%s) : %s\n", fname, strerror(errno));
return -1;
}
if (!S_ISDIR(st.st_mode)) {
return -1;
}
if (!S_ISDIR(st.st_mode)) {
-
f
printf(FERROR,"unlink(%s) : %s\n", fname, strerror(errno));
+
r
printf(FERROR,"unlink(%s) : %s\n", fname, strerror(errno));
return -1;
}
if (do_rmdir(fname) == 0 || errno == ENOENT) return 0;
if (!force_delete || (errno != ENOTEMPTY && errno != EEXIST)) {
return -1;
}
if (do_rmdir(fname) == 0 || errno == ENOENT) return 0;
if (!force_delete || (errno != ENOTEMPTY && errno != EEXIST)) {
-
f
printf(FERROR,"rmdir(%s) : %s\n", fname, strerror(errno));
+
r
printf(FERROR,"rmdir(%s) : %s\n", fname, strerror(errno));
return -1;
}
/* now we do a recsursive delete on the directory ... */
d = opendir(fname);
if (!d) {
return -1;
}
/* now we do a recsursive delete on the directory ... */
d = opendir(fname);
if (!d) {
-
f
printf(FERROR,"opendir(%s): %s\n",
+
r
printf(FERROR,"opendir(%s): %s\n",
fname,strerror(errno));
return -1;
}
fname,strerror(errno));
return -1;
}
@@
-116,7
+116,7
@@
static int delete_file(char *fname)
strcat(buf, dname);
buf[MAXPATHLEN-1] = 0;
if (verbose > 0)
strcat(buf, dname);
buf[MAXPATHLEN-1] = 0;
if (verbose > 0)
-
f
printf(FINFO,"deleting %s\n", buf);
+
r
printf(FINFO,"deleting %s\n", buf);
if (delete_file(buf) != 0) {
closedir(d);
return -1;
if (delete_file(buf) != 0) {
closedir(d);
return -1;
@@
-126,7
+126,7
@@
static int delete_file(char *fname)
closedir(d);
if (do_rmdir(fname) != 0) {
closedir(d);
if (do_rmdir(fname) != 0) {
-
f
printf(FERROR,"rmdir(%s) : %s\n", fname, strerror(errno));
+
r
printf(FERROR,"rmdir(%s) : %s\n", fname, strerror(errno));
return -1;
}
return -1;
}
@@
-184,7
+184,7
@@
static struct sum_struct *generate_sums(struct map_struct *buf,OFF_T len,int n)
}
if (verbose > 3)
}
if (verbose > 3)
-
f
printf(FINFO,"count=%d rem=%d n=%d flength=%d\n",
+
r
printf(FINFO,"count=%d rem=%d n=%d flength=%d\n",
s->count,s->remainder,s->n,(int)s->flength);
s->sums = (struct sum_buf *)malloc(sizeof(s->sums[0])*s->count);
s->count,s->remainder,s->n,(int)s->flength);
s->sums = (struct sum_buf *)malloc(sizeof(s->sums[0])*s->count);
@@
-202,7
+202,7
@@
static struct sum_struct *generate_sums(struct map_struct *buf,OFF_T len,int n)
s->sums[i].i = i;
if (verbose > 3)
s->sums[i].i = i;
if (verbose > 3)
-
f
printf(FINFO,"chunk[%d] offset=%d len=%d sum1=%08x\n",
+
r
printf(FINFO,"chunk[%d] offset=%d len=%d sum1=%08x\n",
i,(int)s->sums[i].offset,s->sums[i].len,s->sums[i].sum1);
len -= n1;
i,(int)s->sums[i].offset,s->sums[i].len,s->sums[i].sum1);
len -= n1;
@@
-231,7
+231,7
@@
static struct sum_struct *receive_sums(int f)
s->sums = NULL;
if (verbose > 3)
s->sums = NULL;
if (verbose > 3)
-
f
printf(FINFO,"count=%d n=%d rem=%d\n",
+
r
printf(FINFO,"count=%d n=%d rem=%d\n",
s->count,s->n,s->remainder);
if (s->count == 0)
s->count,s->n,s->remainder);
if (s->count == 0)
@@
-255,7
+255,7
@@
static struct sum_struct *receive_sums(int f)
offset += s->sums[i].len;
if (verbose > 3)
offset += s->sums[i].len;
if (verbose > 3)
-
f
printf(FINFO,"chunk[%d] len=%d offset=%d sum1=%08x\n",
+
r
printf(FINFO,"chunk[%d] len=%d offset=%d sum1=%08x\n",
i,s->sums[i].len,(int)s->sums[i].offset,s->sums[i].sum1);
}
i,s->sums[i].len,(int)s->sums[i].offset,s->sums[i].sum1);
}
@@
-275,7
+275,7
@@
static int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
if (!st) {
if (link_stat(fname,&st2) != 0) {
if (!st) {
if (link_stat(fname,&st2) != 0) {
-
f
printf(FERROR,"stat %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"stat %s : %s\n",fname,strerror(errno));
return 0;
}
st = &st2;
return 0;
}
st = &st2;
@@
-285,7
+285,7
@@
static int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
st->st_mtime != file->modtime) {
updated = 1;
if (set_modtime(fname,file->modtime) != 0) {
st->st_mtime != file->modtime) {
updated = 1;
if (set_modtime(fname,file->modtime) != 0) {
-
f
printf(FERROR,"failed to set times on %s : %s\n",
+
r
printf(FERROR,"failed to set times on %s : %s\n",
fname,strerror(errno));
return 0;
}
fname,strerror(errno));
return 0;
}
@@
-296,7
+296,7
@@
static int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
st->st_mode != file->mode) {
updated = 1;
if (do_chmod(fname,file->mode) != 0) {
st->st_mode != file->mode) {
updated = 1;
if (do_chmod(fname,file->mode) != 0) {
-
f
printf(FERROR,"failed to set permissions on %s : %s\n",
+
r
printf(FERROR,"failed to set permissions on %s : %s\n",
fname,strerror(errno));
return 0;
}
fname,strerror(errno));
return 0;
}
@@
-311,7
+311,7
@@
static int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
if (preserve_uid && st->st_uid != file->uid)
updated = 1;
if (verbose>1 || preserve_uid)
if (preserve_uid && st->st_uid != file->uid)
updated = 1;
if (verbose>1 || preserve_uid)
-
f
printf(FERROR,"chown %s : %s\n",
+
r
printf(FERROR,"chown %s : %s\n",
fname,strerror(errno));
return updated;
}
fname,strerror(errno));
return updated;
}
@@
-320,9
+320,9
@@
static int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
if (verbose > 1 && report) {
if (updated)
if (verbose > 1 && report) {
if (updated)
-
f
printf(FINFO,"%s\n",fname);
+
r
printf(FINFO,"%s\n",fname);
else
else
-
f
printf(FINFO,"%s is uptodate\n",fname);
+
r
printf(FINFO,"%s is uptodate\n",fname);
}
return updated;
}
}
return updated;
}
@@
-372,7
+372,7
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
struct file_struct *file = flist->files[i];
if (verbose > 2)
struct file_struct *file = flist->files[i];
if (verbose > 2)
-
f
printf(FINFO,"recv_generator(%s,%d)\n",fname,i);
+
r
printf(FINFO,"recv_generator(%s,%d)\n",fname,i);
statret = link_stat(fname,&st);
statret = link_stat(fname,&st);
@@
-380,7
+380,7
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
if (dry_run) return;
if (statret == 0 && !S_ISDIR(st.st_mode)) {
if (do_unlink(fname) != 0) {
if (dry_run) return;
if (statret == 0 && !S_ISDIR(st.st_mode)) {
if (do_unlink(fname) != 0) {
-
f
printf(FERROR,"unlink %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"unlink %s : %s\n",fname,strerror(errno));
return;
}
statret = -1;
return;
}
statret = -1;
@@
-389,12
+389,12
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
if (!(relative_paths && errno==ENOENT &&
create_directory_path(fname)==0 &&
do_mkdir(fname,file->mode)==0)) {
if (!(relative_paths && errno==ENOENT &&
create_directory_path(fname)==0 &&
do_mkdir(fname,file->mode)==0)) {
-
f
printf(FERROR,"mkdir %s : %s (2)\n",
+
r
printf(FERROR,"mkdir %s : %s (2)\n",
fname,strerror(errno));
}
}
if (set_perms(fname,file,NULL,0) && verbose)
fname,strerror(errno));
}
}
if (set_perms(fname,file,NULL,0) && verbose)
-
f
printf(FINFO,"%s/\n",fname);
+
r
printf(FINFO,"%s/\n",fname);
return;
}
return;
}
@@
-414,12
+414,12
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
}
delete_file(fname);
if (do_symlink(file->link,fname) != 0) {
}
delete_file(fname);
if (do_symlink(file->link,fname) != 0) {
-
f
printf(FERROR,"link %s -> %s : %s\n",
+
r
printf(FERROR,"link %s -> %s : %s\n",
fname,file->link,strerror(errno));
} else {
set_perms(fname,file,NULL,0);
if (verbose)
fname,file->link,strerror(errno));
} else {
set_perms(fname,file,NULL,0);
if (verbose)
-
f
printf(FINFO,"%s -> %s\n",
+
r
printf(FINFO,"%s -> %s\n",
fname,file->link);
}
#endif
fname,file->link);
}
#endif
@@
-433,14
+433,14
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
st.st_rdev != file->rdev) {
delete_file(fname);
if (verbose > 2)
st.st_rdev != file->rdev) {
delete_file(fname);
if (verbose > 2)
-
f
printf(FINFO,"mknod(%s,0%o,0x%x)\n",
+
r
printf(FINFO,"mknod(%s,0%o,0x%x)\n",
fname,(int)file->mode,(int)file->rdev);
if (do_mknod(fname,file->mode,file->rdev) != 0) {
fname,(int)file->mode,(int)file->rdev);
if (do_mknod(fname,file->mode,file->rdev) != 0) {
-
f
printf(FERROR,"mknod %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"mknod %s : %s\n",fname,strerror(errno));
} else {
set_perms(fname,file,NULL,0);
if (verbose)
} else {
set_perms(fname,file,NULL,0);
if (verbose)
-
f
printf(FINFO,"%s\n",fname);
+
r
printf(FINFO,"%s\n",fname);
}
} else {
set_perms(fname,file,&st,1);
}
} else {
set_perms(fname,file,&st,1);
@@
-451,12
+451,12
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
if (preserve_hard_links && check_hard_link(file)) {
if (verbose > 1)
if (preserve_hard_links && check_hard_link(file)) {
if (verbose > 1)
-
f
printf(FINFO,"%s is a hard link\n",f_name(file));
+
r
printf(FINFO,"%s is a hard link\n",f_name(file));
return;
}
if (!S_ISREG(file->mode)) {
return;
}
if (!S_ISREG(file->mode)) {
-
f
printf(FINFO,"skipping non-regular file %s\n",fname);
+
r
printf(FINFO,"skipping non-regular file %s\n",fname);
return;
}
return;
}
@@
-466,7
+466,7
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
if (!dry_run) send_sums(NULL,f_out);
} else {
if (verbose > 1)
if (!dry_run) send_sums(NULL,f_out);
} else {
if (verbose > 1)
-
f
printf(FERROR,"recv_generator failed to open %s\n",fname);
+
r
printf(FERROR,"recv_generator failed to open %s\n",fname);
}
return;
}
}
return;
}
@@
-484,7
+484,7
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
if (update_only && st.st_mtime > file->modtime) {
if (verbose > 1)
if (update_only && st.st_mtime > file->modtime) {
if (verbose > 1)
-
f
printf(FINFO,"%s is newer\n",fname);
+
r
printf(FINFO,"%s is newer\n",fname);
return;
}
return;
}
@@
-508,8
+508,8
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
fd = open(fname,O_RDONLY);
if (fd == -1) {
fd = open(fname,O_RDONLY);
if (fd == -1) {
-
f
printf(FERROR,"failed to open %s : %s\n",fname,strerror(errno));
-
f
printf(FERROR,"skipping %s\n",fname);
+
r
printf(FERROR,"failed to open %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"skipping %s\n",fname);
return;
}
return;
}
@@
-520,12
+520,12
@@
void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
}
if (verbose > 3)
}
if (verbose > 3)
-
f
printf(FINFO,"gen mapped %s of size %d\n",fname,(int)st.st_size);
+
r
printf(FINFO,"gen mapped %s of size %d\n",fname,(int)st.st_size);
s = generate_sums(buf,st.st_size,adapt_block_size(file, block_size));
if (verbose > 2)
s = generate_sums(buf,st.st_size,adapt_block_size(file, block_size));
if (verbose > 2)
-
f
printf(FINFO,"sending sums for %d\n",i);
+
r
printf(FINFO,"sending sums for %d\n",i);
write_int(f_out,i);
send_sums(s,f_out);
write_int(f_out,i);
send_sums(s,f_out);
@@
-558,12
+558,12
@@
static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
for (i=recv_token(f_in,&data); i != 0; i=recv_token(f_in,&data)) {
if (i > 0) {
if (verbose > 3)
for (i=recv_token(f_in,&data); i != 0; i=recv_token(f_in,&data)) {
if (i > 0) {
if (verbose > 3)
-
f
printf(FINFO,"data recv %d at %d\n",i,(int)offset);
+
r
printf(FINFO,"data recv %d at %d\n",i,(int)offset);
sum_update(data,i);
if (fd != -1 && write_file(fd,data,i) != i) {
sum_update(data,i);
if (fd != -1 && write_file(fd,data,i) != i) {
-
f
printf(FERROR,"write failed on %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"write failed on %s : %s\n",fname,strerror(errno));
exit_cleanup(1);
}
offset += i;
exit_cleanup(1);
}
offset += i;
@@
-575,7
+575,7
@@
static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
len = remainder;
if (verbose > 3)
len = remainder;
if (verbose > 3)
-
f
printf(FINFO,"chunk[%d] of size %d at %d offset=%d\n",
+
r
printf(FINFO,"chunk[%d] of size %d at %d offset=%d\n",
i,len,(int)offset2,(int)offset);
map = map_ptr(buf,offset2,len);
i,len,(int)offset2,(int)offset);
map = map_ptr(buf,offset2,len);
@@
-584,7
+584,7
@@
static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
sum_update(map,len);
if (fd != -1 && write_file(fd,map,len) != len) {
sum_update(map,len);
if (fd != -1 && write_file(fd,map,len) != len) {
-
f
printf(FERROR,"write failed on %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"write failed on %s : %s\n",fname,strerror(errno));
exit_cleanup(1);
}
offset += len;
exit_cleanup(1);
}
offset += len;
@@
-592,7
+592,7
@@
static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
}
if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
}
if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
-
f
printf(FERROR,"write failed on %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"write failed on %s : %s\n",fname,strerror(errno));
exit_cleanup(1);
}
exit_cleanup(1);
}
@@
-601,7
+601,7
@@
static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
if (remote_version >= 14) {
read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
if (verbose > 2)
if (remote_version >= 14) {
read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
if (verbose > 2)
-
f
printf(FINFO,"got file_sum\n");
+
r
printf(FINFO,"got file_sum\n");
if (fd != -1 && memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0)
return 0;
}
if (fd != -1 && memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0)
return 0;
}
@@
-613,16
+613,16
@@
static void delete_one(struct file_struct *f)
{
if (!S_ISDIR(f->mode)) {
if (do_unlink(f_name(f)) != 0) {
{
if (!S_ISDIR(f->mode)) {
if (do_unlink(f_name(f)) != 0) {
-
f
printf(FERROR,"unlink %s : %s\n",f_name(f),strerror(errno));
+
r
printf(FERROR,"unlink %s : %s\n",f_name(f),strerror(errno));
} else if (verbose) {
} else if (verbose) {
-
f
printf(FINFO,"deleting %s\n",f_name(f));
+
r
printf(FINFO,"deleting %s\n",f_name(f));
}
} else {
if (do_rmdir(f_name(f)) != 0) {
if (errno != ENOTEMPTY && errno != EEXIST)
}
} else {
if (do_rmdir(f_name(f)) != 0) {
if (errno != ENOTEMPTY && errno != EEXIST)
-
f
printf(FERROR,"rmdir %s : %s\n",f_name(f),strerror(errno));
+
r
printf(FERROR,"rmdir %s : %s\n",f_name(f),strerror(errno));
} else if (verbose) {
} else if (verbose) {
-
f
printf(FINFO,"deleting directory %s\n",f_name(f));
+
r
printf(FINFO,"deleting directory %s\n",f_name(f));
}
}
}
}
}
}
@@
-652,7
+652,7
@@
static void add_delete_entry(struct file_struct *file)
dlist_len++;
if (verbose > 3)
dlist_len++;
if (verbose > 3)
-
f
printf(FINFO,"added %s to delete list\n", f_name(file));
+
r
printf(FINFO,"added %s to delete list\n", f_name(file));
}
/* yuck! This function wouldn't have been necessary if I had the sorting
}
/* yuck! This function wouldn't have been necessary if I had the sorting
@@
-689,7
+689,7
@@
static void delete_files(struct file_list *flist)
add_cvs_excludes();
if (io_error) {
add_cvs_excludes();
if (io_error) {
-
f
printf(FINFO,"IO error encountered - skipping file deletion\n");
+
r
printf(FINFO,"IO error encountered - skipping file deletion\n");
return;
}
return;
}
@@
-707,7
+707,7
@@
static void delete_files(struct file_list *flist)
}
if (verbose > 1)
}
if (verbose > 1)
-
f
printf(FINFO,"deleting in %s\n", name);
+
r
printf(FINFO,"deleting in %s\n", name);
for (i=local_file_list->count-1;i>=0;i--) {
if (!local_file_list->files[i]->basename) continue;
for (i=local_file_list->count-1;i>=0;i--) {
if (!local_file_list->files[i]->basename) continue;
@@
-754,7
+754,7
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
int recv_ok;
if (verbose > 2) {
int recv_ok;
if (verbose > 2) {
-
f
printf(FINFO,"recv_files(%d) starting\n",flist->count);
+
r
printf(FINFO,"recv_files(%d) starting\n",flist->count);
}
if (recurse && delete_mode && !local_name && flist->count>0) {
}
if (recurse && delete_mode && !local_name && flist->count>0) {
@@
-769,7
+769,7
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
phase++;
csum_length = SUM_LENGTH;
if (verbose > 2)
phase++;
csum_length = SUM_LENGTH;
if (verbose > 2)
-
f
printf(FINFO,"recv_files phase=%d\n",phase);
+
r
printf(FINFO,"recv_files phase=%d\n",phase);
write_int(f_gen,-1);
write_flush(f_gen);
continue;
write_int(f_gen,-1);
write_flush(f_gen);
continue;
@@
-790,20
+790,20
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
}
if (verbose > 2)
}
if (verbose > 2)
-
f
printf(FINFO,"recv_files(%s)\n",fname);
+
r
printf(FINFO,"recv_files(%s)\n",fname);
/* open the file */
fd1 = open(fname,O_RDONLY);
if (fd1 != -1 && do_fstat(fd1,&st) != 0) {
/* open the file */
fd1 = open(fname,O_RDONLY);
if (fd1 != -1 && do_fstat(fd1,&st) != 0) {
-
f
printf(FERROR,"fstat %s : %s\n",fname,strerror(errno));
+
r
printf(FERROR,"fstat %s : %s\n",fname,strerror(errno));
receive_data(f_in,NULL,-1,NULL);
close(fd1);
continue;
}
if (fd1 != -1 && !S_ISREG(st.st_mode)) {
receive_data(f_in,NULL,-1,NULL);
close(fd1);
continue;
}
if (fd1 != -1 && !S_ISREG(st.st_mode)) {
-
f
printf(FERROR,"%s : not a regular file (recv_files)\n",fname);
+
r
printf(FERROR,"%s : not a regular file (recv_files)\n",fname);
receive_data(f_in,NULL,-1,NULL);
close(fd1);
continue;
receive_data(f_in,NULL,-1,NULL);
close(fd1);
continue;
@@
-812,14
+812,14
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
if (fd1 != -1 && st.st_size > 0) {
buf = map_file(fd1,st.st_size);
if (verbose > 2)
if (fd1 != -1 && st.st_size > 0) {
buf = map_file(fd1,st.st_size);
if (verbose > 2)
-
f
printf(FINFO,"recv mapped %s of size %d\n",fname,(int)st.st_size);
+
r
printf(FINFO,"recv mapped %s of size %d\n",fname,(int)st.st_size);
} else {
buf = NULL;
}
/* open tmp file */
if (strlen(fname) > (MAXPATHLEN-8)) {
} else {
buf = NULL;
}
/* open tmp file */
if (strlen(fname) > (MAXPATHLEN-8)) {
-
f
printf(FERROR,"filename too long\n");
+
r
printf(FERROR,"filename too long\n");
if (buf) unmap_file(buf);
close(fd1);
continue;
if (buf) unmap_file(buf);
close(fd1);
continue;
@@
-836,7
+836,7
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
sprintf(fnametmp,"%s.XXXXXX",fname);
}
if (NULL == do_mktemp(fnametmp)) {
sprintf(fnametmp,"%s.XXXXXX",fname);
}
if (NULL == do_mktemp(fnametmp)) {
-
f
printf(FERROR,"mktemp %s failed\n",fnametmp);
+
r
printf(FERROR,"mktemp %s failed\n",fnametmp);
receive_data(f_in,buf,-1,NULL);
if (buf) unmap_file(buf);
close(fd1);
receive_data(f_in,buf,-1,NULL);
if (buf) unmap_file(buf);
close(fd1);
@@
-848,7
+848,7
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
fd2 = do_open(fnametmp,O_WRONLY|O_CREAT|O_EXCL,file->mode);
}
if (fd2 == -1) {
fd2 = do_open(fnametmp,O_WRONLY|O_CREAT|O_EXCL,file->mode);
}
if (fd2 == -1) {
-
f
printf(FERROR,"open %s : %s\n",fnametmp,strerror(errno));
+
r
printf(FERROR,"open %s : %s\n",fnametmp,strerror(errno));
receive_data(f_in,buf,-1,NULL);
if (buf) unmap_file(buf);
close(fd1);
receive_data(f_in,buf,-1,NULL);
if (buf) unmap_file(buf);
close(fd1);
@@
-870,17
+870,17
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
close(fd2);
if (verbose > 2)
close(fd2);
if (verbose > 2)
-
f
printf(FINFO,"renaming %s to %s\n",fnametmp,fname);
+
r
printf(FINFO,"renaming %s to %s\n",fnametmp,fname);
if (make_backups) {
char fnamebak[MAXPATHLEN];
if (strlen(fname) + strlen(backup_suffix) > (MAXPATHLEN-1)) {
if (make_backups) {
char fnamebak[MAXPATHLEN];
if (strlen(fname) + strlen(backup_suffix) > (MAXPATHLEN-1)) {
-
f
printf(FERROR,"backup filename too long\n");
+
r
printf(FERROR,"backup filename too long\n");
continue;
}
sprintf(fnamebak,"%s%s",fname,backup_suffix);
if (do_rename(fname,fnamebak) != 0 && errno != ENOENT) {
continue;
}
sprintf(fnamebak,"%s%s",fname,backup_suffix);
if (do_rename(fname,fnamebak) != 0 && errno != ENOENT) {
-
f
printf(FERROR,"rename %s %s : %s\n",fname,fnamebak,strerror(errno));
+
r
printf(FERROR,"rename %s %s : %s\n",fname,fnamebak,strerror(errno));
continue;
}
}
continue;
}
}
@@
-891,14
+891,14
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
/* rename failed on cross-filesystem link.
Copy the file instead. */
if (copy_file(fnametmp,fname, file->mode)) {
/* rename failed on cross-filesystem link.
Copy the file instead. */
if (copy_file(fnametmp,fname, file->mode)) {
-
f
printf(FERROR,"copy %s -> %s : %s\n",
+
r
printf(FERROR,"copy %s -> %s : %s\n",
fnametmp,fname,strerror(errno));
} else {
set_perms(fname,file,NULL,0);
}
do_unlink(fnametmp);
} else {
fnametmp,fname,strerror(errno));
} else {
set_perms(fname,file,NULL,0);
}
do_unlink(fnametmp);
} else {
-
f
printf(FERROR,"rename %s -> %s : %s\n",
+
r
printf(FERROR,"rename %s -> %s : %s\n",
fnametmp,fname,strerror(errno));
do_unlink(fnametmp);
}
fnametmp,fname,strerror(errno));
do_unlink(fnametmp);
}
@@
-911,11
+911,11
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
if (!recv_ok) {
if (csum_length == SUM_LENGTH) {
if (!recv_ok) {
if (csum_length == SUM_LENGTH) {
-
f
printf(FERROR,"ERROR: file corruption in %s. File changed during transfer?\n",
+
r
printf(FERROR,"ERROR: file corruption in %s. File changed during transfer?\n",
fname);
} else {
if (verbose > 1)
fname);
} else {
if (verbose > 1)
-
f
printf(FINFO,"redoing %s(%d)\n",fname,i);
+
r
printf(FINFO,"redoing %s(%d)\n",fname,i);
write_int(f_gen,i);
}
}
write_int(f_gen,i);
}
}
@@
-933,7
+933,7
@@
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
}
if (verbose > 2)
}
if (verbose > 2)
-
f
printf(FINFO,"recv_files finished\n");
+
r
printf(FINFO,"recv_files finished\n");
return 0;
}
return 0;
}
@@
-953,7
+953,7
@@
void send_files(struct file_list *flist,int f_out,int f_in)
int offset=0;
if (verbose > 2)
int offset=0;
if (verbose > 2)
-
f
printf(FINFO,"send_files starting\n");
+
r
printf(FINFO,"send_files starting\n");
setup_nonblocking(f_in,f_out);
setup_nonblocking(f_in,f_out);
@@
-966,7
+966,7
@@
void send_files(struct file_list *flist,int f_out,int f_in)
write_int(f_out,-1);
write_flush(f_out);
if (verbose > 2)
write_int(f_out,-1);
write_flush(f_out);
if (verbose > 2)
-
f
printf(FINFO,"send_files phase=%d\n",phase);
+
r
printf(FINFO,"send_files phase=%d\n",phase);
continue;
}
break;
continue;
}
break;
@@
-980,7
+980,7
@@
void send_files(struct file_list *flist,int f_out,int f_in)
fname[MAXPATHLEN-1] = 0;
if (strlen(fname) == MAXPATHLEN-1) {
io_error = 1;
fname[MAXPATHLEN-1] = 0;
if (strlen(fname) == MAXPATHLEN-1) {
io_error = 1;
-
f
printf(FERROR, "send_files failed on long-named directory %s\n",
+
r
printf(FERROR, "send_files failed on long-named directory %s\n",
fname);
return;
}
fname);
return;
}
@@
-990,7
+990,7
@@
void send_files(struct file_list *flist,int f_out,int f_in)
strncat(fname,f_name(file),MAXPATHLEN-strlen(fname));
if (verbose > 2)
strncat(fname,f_name(file),MAXPATHLEN-strlen(fname));
if (verbose > 2)
-
f
printf(FINFO,"send_files(%d,%s)\n",i,fname);
+
r
printf(FINFO,"send_files(%d,%s)\n",i,fname);
if (dry_run) {
if (!am_server && verbose)
if (dry_run) {
if (!am_server && verbose)
@@
-1002,14
+1002,14
@@
void send_files(struct file_list *flist,int f_out,int f_in)
s = receive_sums(f_in);
if (!s) {
io_error = 1;
s = receive_sums(f_in);
if (!s) {
io_error = 1;
-
f
printf(FERROR,"receive_sums failed\n");
+
r
printf(FERROR,"receive_sums failed\n");
return;
}
fd = open(fname,O_RDONLY);
if (fd == -1) {
io_error = 1;
return;
}
fd = open(fname,O_RDONLY);
if (fd == -1) {
io_error = 1;
-
f
printf(FERROR,"send_files failed to open %s: %s\n",
+
r
printf(FERROR,"send_files failed to open %s: %s\n",
fname,strerror(errno));
free_sums(s);
continue;
fname,strerror(errno));
free_sums(s);
continue;
@@
-1018,7
+1018,7
@@
void send_files(struct file_list *flist,int f_out,int f_in)
/* map the local file */
if (do_fstat(fd,&st) != 0) {
io_error = 1;
/* map the local file */
if (do_fstat(fd,&st) != 0) {
io_error = 1;
-
f
printf(FERROR,"fstat failed : %s\n",strerror(errno));
+
r
printf(FERROR,"fstat failed : %s\n",strerror(errno));
free_sums(s);
close(fd);
return;
free_sums(s);
close(fd);
return;
@@
-1031,7
+1031,7
@@
void send_files(struct file_list *flist,int f_out,int f_in)
}
if (verbose > 2)
}
if (verbose > 2)
-
f
printf(FINFO,"send_files mapped %s of size %d\n",
+
r
printf(FINFO,"send_files mapped %s of size %d\n",
fname,(int)st.st_size);
write_int(f_out,i);
fname,(int)st.st_size);
write_int(f_out,i);
@@
-1041,7
+1041,7
@@
void send_files(struct file_list *flist,int f_out,int f_in)
write_int(f_out,s->remainder);
if (verbose > 2)
write_int(f_out,s->remainder);
if (verbose > 2)
-
f
printf(FINFO,"calling match_sums %s\n",fname);
+
r
printf(FINFO,"calling match_sums %s\n",fname);
if (!am_server && verbose)
printf("%s\n",fname+offset);
if (!am_server && verbose)
printf("%s\n",fname+offset);
@@
-1055,11
+1055,11
@@
void send_files(struct file_list *flist,int f_out,int f_in)
free_sums(s);
if (verbose > 2)
free_sums(s);
if (verbose > 2)
-
f
printf(FINFO,"sender finished %s\n",fname);
+
r
printf(FINFO,"sender finished %s\n",fname);
}
if (verbose > 2)
}
if (verbose > 2)
-
f
printf(FINFO,"send files finished\n");
+
r
printf(FINFO,"send files finished\n");
match_report();
match_report();
@@
-1075,7
+1075,7
@@
void generate_files(int f,struct file_list *flist,char *local_name,int f_recv)
int phase=0;
if (verbose > 2)
int phase=0;
if (verbose > 2)
-
f
printf(FINFO,"generator starting pid=%d count=%d\n",
+
r
printf(FINFO,"generator starting pid=%d count=%d\n",
(int)getpid(),flist->count);
for (i = 0; i < flist->count; i++) {
(int)getpid(),flist->count);
for (i = 0; i < flist->count; i++) {
@@
-1101,7
+1101,7
@@
void generate_files(int f,struct file_list *flist,char *local_name,int f_recv)
ignore_times=1;
if (verbose > 2)
ignore_times=1;
if (verbose > 2)
-
f
printf(FINFO,"generate_files phase=%d\n",phase);
+
r
printf(FINFO,"generate_files phase=%d\n",phase);
write_int(f,-1);
write_flush(f);
write_int(f,-1);
write_flush(f);
@@
-1121,7
+1121,7
@@
void generate_files(int f,struct file_list *flist,char *local_name,int f_recv)
phase++;
if (verbose > 2)
phase++;
if (verbose > 2)
-
f
printf(FINFO,"generate_files phase=%d\n",phase);
+
r
printf(FINFO,"generate_files phase=%d\n",phase);
write_int(f,-1);
write_flush(f);
write_int(f,-1);
write_flush(f);
@@
-1129,7
+1129,7
@@
void generate_files(int f,struct file_list *flist,char *local_name,int f_recv)
if (verbose > 2)
if (verbose > 2)
-
f
printf(FINFO,"generator wrote %ld\n",(long)write_total());
+
r
printf(FINFO,"generator wrote %ld\n",(long)write_total());
}
}