version 1.3, 2019/02/10 23:43:31 |
version 1.4, 2019/02/11 19:18:36 |
|
|
|
|
/* Client sends zero-length exclusions. */ |
/* Client sends zero-length exclusions. */ |
|
|
if ( ! sess->opts->server && |
if (!sess->opts->server && |
! io_write_int(sess, fdout, 0)) { |
!io_write_int(sess, fdout, 0)) { |
ERRX1(sess, "io_write_int"); |
ERRX1(sess, "io_write_int"); |
goto out; |
goto out; |
} |
} |
|
|
if (sess->opts->server && sess->opts->del) { |
if (sess->opts->server && sess->opts->del) { |
if ( ! io_read_size(sess, fdin, &excl)) { |
if (!io_read_size(sess, fdin, &excl)) { |
ERRX1(sess, "io_read_size"); |
ERRX1(sess, "io_read_size"); |
goto out; |
goto out; |
} else if (0 != excl) { |
} else if (0 != excl) { |
|
|
* These we're going to be touching on our local system. |
* These we're going to be touching on our local system. |
*/ |
*/ |
|
|
if ( ! flist_recv(sess, fdin, &fl, &flsz)) { |
if (!flist_recv(sess, fdin, &fl, &flsz)) { |
ERRX1(sess, "flist_recv"); |
ERRX1(sess, "flist_recv"); |
goto out; |
goto out; |
} |
} |
|
|
/* The IO error is sent after the file list. */ |
/* The IO error is sent after the file list. */ |
|
|
if ( ! io_read_int(sess, fdin, &ioerror)) { |
if (!io_read_int(sess, fdin, &ioerror)) { |
ERRX1(sess, "io_read_int"); |
ERRX1(sess, "io_read_int"); |
goto out; |
goto out; |
} else if (0 != ioerror) { |
} else if (0 != ioerror) { |
|
|
goto out; |
goto out; |
} |
} |
|
|
if (0 == flsz && ! sess->opts->server) { |
if (0 == flsz && !sess->opts->server) { |
WARNX(sess, "receiver has empty file list: exiting"); |
WARNX(sess, "receiver has empty file list: exiting"); |
rc = 1; |
rc = 1; |
goto out; |
goto out; |
} else if ( ! sess->opts->server) |
} else if (!sess->opts->server) |
LOG1(sess, "Transfer starting: %zu files", flsz); |
LOG1(sess, "Transfer starting: %zu files", flsz); |
|
|
LOG2(sess, "%s: receiver destination", root); |
LOG2(sess, "%s: receiver destination", root); |
|
|
* this directory in post_dir(). |
* this directory in post_dir(). |
*/ |
*/ |
|
|
if ( ! sess->opts->dry_run) { |
if (!sess->opts->dry_run) { |
if (NULL == (tofree = strdup(root))) { |
if (NULL == (tofree = strdup(root))) { |
ERR(sess, "strdup"); |
ERR(sess, "strdup"); |
goto out; |
goto out; |
|
|
|
|
oumask = umask(0); |
oumask = umask(0); |
|
|
if ( ! sess->opts->dry_run) { |
if (!sess->opts->dry_run) { |
dfd = open(root, O_RDONLY | O_DIRECTORY, 0); |
dfd = open(root, O_RDONLY | O_DIRECTORY, 0); |
if (-1 == dfd) { |
if (-1 == dfd) { |
ERR(sess, "%s: open", root); |
ERR(sess, "%s: open", root); |
|
|
|
|
if (sess->opts->del && |
if (sess->opts->del && |
sess->opts->recursive && |
sess->opts->recursive && |
! flist_gen_dels(sess, root, &dfl, &dflsz, fl, flsz)) { |
!flist_gen_dels(sess, root, &dfl, &dflsz, fl, flsz)) { |
ERRX1(sess, "flist_gen_local"); |
ERRX1(sess, "flist_gen_local"); |
goto out; |
goto out; |
} |
} |
|
|
|
|
/* If we have a local set, go for the deletion. */ |
/* If we have a local set, go for the deletion. */ |
|
|
if ( ! flist_del(sess, dfd, dfl, dflsz)) { |
if (!flist_del(sess, dfd, dfl, dflsz)) { |
ERRX1(sess, "flist_del"); |
ERRX1(sess, "flist_del"); |
goto out; |
goto out; |
} |
} |
|
|
|
|
if (sess->mplex_reads && |
if (sess->mplex_reads && |
(POLLIN & pfd[PFD_SENDER_IN].revents)) { |
(POLLIN & pfd[PFD_SENDER_IN].revents)) { |
if ( ! io_read_flush(sess, fdin)) { |
if (!io_read_flush(sess, fdin)) { |
ERRX1(sess, "io_read_flush"); |
ERRX1(sess, "io_read_flush"); |
goto out; |
goto out; |
} else if (0 == sess->mplex_read_remain) |
} else if (0 == sess->mplex_read_remain) |
|
|
/* Properly close us out by progressing through the phases. */ |
/* Properly close us out by progressing through the phases. */ |
|
|
if (1 == phase) { |
if (1 == phase) { |
if ( ! io_write_int(sess, fdout, -1)) { |
if (!io_write_int(sess, fdout, -1)) { |
ERRX1(sess, "io_write_int"); |
ERRX1(sess, "io_write_int"); |
goto out; |
goto out; |
} else if ( ! io_read_int(sess, fdin, &ioerror)) { |
} else if (!io_read_int(sess, fdin, &ioerror)) { |
ERRX1(sess, "io_read_int"); |
ERRX1(sess, "io_read_int"); |
goto out; |
goto out; |
} else if (-1 != ioerror) { |
} else if (-1 != ioerror) { |
|
|
* directory permissions. |
* directory permissions. |
*/ |
*/ |
|
|
if ( ! rsync_uploader_tail(ul, sess)) { |
if (!rsync_uploader_tail(ul, sess)) { |
ERRX1(sess, "rsync_uploader_tail"); |
ERRX1(sess, "rsync_uploader_tail"); |
goto out; |
goto out; |
} |
} |
|
|
/* Process server statistics and say good-bye. */ |
/* Process server statistics and say good-bye. */ |
|
|
if ( ! sess_stats_recv(sess, fdin)) { |
if (!sess_stats_recv(sess, fdin)) { |
ERRX1(sess, "sess_stats_recv"); |
ERRX1(sess, "sess_stats_recv"); |
goto out; |
goto out; |
} else if ( ! io_write_int(sess, fdout, -1)) { |
} else if (!io_write_int(sess, fdout, -1)) { |
ERRX1(sess, "io_write_int"); |
ERRX1(sess, "io_write_int"); |
goto out; |
goto out; |
} |
} |