X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/97feb557ede01b645989d16b2e345aaec0790027..9352b0649b8d6aa21d9d567c1d819a0fa26c7b01:/sender.c diff --git a/sender.c b/sender.c index 1d9a132b..e73ae62f 100644 --- a/sender.c +++ b/sender.c @@ -25,6 +25,8 @@ extern struct stats stats; extern int io_error; extern int dry_run; extern int am_server; +extern int am_daemon; +extern int protocol_version; /** @@ -36,8 +38,6 @@ extern int am_server; **/ void read_sum_head(int f, struct sum_struct *sum) { - extern int protocol_version; - sum->count = read_int(f); sum->blength = read_int(f); if (protocol_version < 27) { @@ -130,7 +130,7 @@ void send_files(struct file_list *flist, int f_out, int f_in) rprintf(FINFO, "send_files starting\n"); while (1) { - int offset = 0; + unsigned int offset; i = read_int(f_in); if (i == -1) { @@ -159,17 +159,11 @@ void send_files(struct file_list *flist, int f_out, int f_in) fname[0] = 0; if (file->basedir) { - strlcpy(fname, file->basedir, MAXPATHLEN); - if (strlen(fname) == MAXPATHLEN-1) { - io_error |= IOERR_GENERAL; - rprintf(FERROR, "send_files failed on long-named directory %s\n", - full_fname(fname)); - return; - } - strlcat(fname, "/", MAXPATHLEN); - offset = strlen(file->basedir)+1; - } - f_name_to(file, fname + offset, MAXPATHLEN - offset); + offset = stringjoin(fname, sizeof fname, + file->basedir, "/", NULL); + } else + offset = 0; + f_name_to(file, fname + offset); if (verbose > 2) rprintf(FINFO, "send_files(%d, %s)\n", i, fname); @@ -198,8 +192,11 @@ void send_files(struct file_list *flist, int f_out, int f_in) fd = do_open(fname, O_RDONLY, 0); if (fd == -1) { if (errno == ENOENT) { + enum logcode c = am_daemon + && protocol_version < 28 ? FERROR + : FINFO; io_error |= IOERR_VANISHED; - rprintf(FINFO, "file has vanished: %s\n", + rprintf(c, "file has vanished: %s\n", full_fname(fname)); } else { io_error |= IOERR_GENERAL; @@ -232,7 +229,7 @@ void send_files(struct file_list *flist, int f_out, int f_in) write_int(f_out, i); if (write_batch) - write_batch_delta_file((char *)&i, sizeof(i)); + write_batch_delta_file((char *)&i, sizeof i); write_sum_head(f_out, s); }