=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/receiver.c,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** src/usr.bin/rsync/receiver.c 2019/02/10 23:43:31 1.3 --- src/usr.bin/rsync/receiver.c 2019/02/11 19:18:36 1.4 *************** *** 1,4 **** ! /* $Id: receiver.c,v 1.3 2019/02/10 23:43:31 benno Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons --- 1,4 ---- ! /* $Id: receiver.c,v 1.4 2019/02/11 19:18:36 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons *************** *** 65,78 **** /* Client sends zero-length exclusions. */ ! if ( ! sess->opts->server && ! ! io_write_int(sess, fdout, 0)) { ERRX1(sess, "io_write_int"); goto out; } if (sess->opts->server && sess->opts->del) { ! if ( ! io_read_size(sess, fdin, &excl)) { ERRX1(sess, "io_read_size"); goto out; } else if (0 != excl) { --- 65,78 ---- /* Client sends zero-length exclusions. */ ! if (!sess->opts->server && ! !io_write_int(sess, fdout, 0)) { ERRX1(sess, "io_write_int"); goto out; } if (sess->opts->server && sess->opts->del) { ! if (!io_read_size(sess, fdin, &excl)) { ERRX1(sess, "io_read_size"); goto out; } else if (0 != excl) { *************** *** 86,99 **** * These we're going to be touching on our local system. */ ! if ( ! flist_recv(sess, fdin, &fl, &flsz)) { ERRX1(sess, "flist_recv"); goto out; } /* The IO error is sent after the file list. */ ! if ( ! io_read_int(sess, fdin, &ioerror)) { ERRX1(sess, "io_read_int"); goto out; } else if (0 != ioerror) { --- 86,99 ---- * These we're going to be touching on our local system. */ ! if (!flist_recv(sess, fdin, &fl, &flsz)) { ERRX1(sess, "flist_recv"); goto out; } /* The IO error is sent after the file list. */ ! if (!io_read_int(sess, fdin, &ioerror)) { ERRX1(sess, "io_read_int"); goto out; } else if (0 != ioerror) { *************** *** 101,111 **** goto out; } ! if (0 == flsz && ! sess->opts->server) { WARNX(sess, "receiver has empty file list: exiting"); rc = 1; goto out; ! } else if ( ! sess->opts->server) LOG1(sess, "Transfer starting: %zu files", flsz); LOG2(sess, "%s: receiver destination", root); --- 101,111 ---- goto out; } ! if (0 == flsz && !sess->opts->server) { WARNX(sess, "receiver has empty file list: exiting"); rc = 1; goto out; ! } else if (!sess->opts->server) LOG1(sess, "Transfer starting: %zu files", flsz); LOG2(sess, "%s: receiver destination", root); *************** *** 117,123 **** * this directory in post_dir(). */ ! if ( ! sess->opts->dry_run) { if (NULL == (tofree = strdup(root))) { ERR(sess, "strdup"); goto out; --- 117,123 ---- * this directory in post_dir(). */ ! if (!sess->opts->dry_run) { if (NULL == (tofree = strdup(root))) { ERR(sess, "strdup"); goto out; *************** *** 136,142 **** oumask = umask(0); ! if ( ! sess->opts->dry_run) { dfd = open(root, O_RDONLY | O_DIRECTORY, 0); if (-1 == dfd) { ERR(sess, "%s: open", root); --- 136,142 ---- oumask = umask(0); ! if (!sess->opts->dry_run) { dfd = open(root, O_RDONLY | O_DIRECTORY, 0); if (-1 == dfd) { ERR(sess, "%s: open", root); *************** *** 154,160 **** if (sess->opts->del && sess->opts->recursive && ! ! flist_gen_dels(sess, root, &dfl, &dflsz, fl, flsz)) { ERRX1(sess, "flist_gen_local"); goto out; } --- 154,160 ---- if (sess->opts->del && sess->opts->recursive && ! !flist_gen_dels(sess, root, &dfl, &dflsz, fl, flsz)) { ERRX1(sess, "flist_gen_local"); goto out; } *************** *** 176,182 **** /* If we have a local set, go for the deletion. */ ! if ( ! flist_del(sess, dfd, dfl, dflsz)) { ERRX1(sess, "flist_del"); goto out; } --- 176,182 ---- /* If we have a local set, go for the deletion. */ ! if (!flist_del(sess, dfd, dfl, dflsz)) { ERRX1(sess, "flist_del"); goto out; } *************** *** 234,240 **** if (sess->mplex_reads && (POLLIN & pfd[PFD_SENDER_IN].revents)) { ! if ( ! io_read_flush(sess, fdin)) { ERRX1(sess, "io_read_flush"); goto out; } else if (0 == sess->mplex_read_remain) --- 234,240 ---- if (sess->mplex_reads && (POLLIN & pfd[PFD_SENDER_IN].revents)) { ! if (!io_read_flush(sess, fdin)) { ERRX1(sess, "io_read_flush"); goto out; } else if (0 == sess->mplex_read_remain) *************** *** 296,305 **** /* Properly close us out by progressing through the phases. */ if (1 == phase) { ! if ( ! io_write_int(sess, fdout, -1)) { ERRX1(sess, "io_write_int"); goto out; ! } else if ( ! io_read_int(sess, fdin, &ioerror)) { ERRX1(sess, "io_read_int"); goto out; } else if (-1 != ioerror) { --- 296,305 ---- /* Properly close us out by progressing through the phases. */ if (1 == phase) { ! if (!io_write_int(sess, fdout, -1)) { ERRX1(sess, "io_write_int"); goto out; ! } else if (!io_read_int(sess, fdin, &ioerror)) { ERRX1(sess, "io_read_int"); goto out; } else if (-1 != ioerror) { *************** *** 313,329 **** * directory permissions. */ ! if ( ! rsync_uploader_tail(ul, sess)) { ERRX1(sess, "rsync_uploader_tail"); goto out; } /* Process server statistics and say good-bye. */ ! if ( ! sess_stats_recv(sess, fdin)) { ERRX1(sess, "sess_stats_recv"); goto out; ! } else if ( ! io_write_int(sess, fdout, -1)) { ERRX1(sess, "io_write_int"); goto out; } --- 313,329 ---- * directory permissions. */ ! if (!rsync_uploader_tail(ul, sess)) { ERRX1(sess, "rsync_uploader_tail"); goto out; } /* Process server statistics and say good-bye. */ ! if (!sess_stats_recv(sess, fdin)) { ERRX1(sess, "sess_stats_recv"); goto out; ! } else if (!io_write_int(sess, fdout, -1)) { ERRX1(sess, "io_write_int"); goto out; }