X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/1faa1a6da93065febb7e08830e5da37a09b6444d..8e41b68e8f975c02a5d9281be780ba5d1a385107:/io.c diff --git a/io.c b/io.c index 897efc24..0ab9f57b 100644 --- a/io.c +++ b/io.c @@ -7,8 +7,9 @@ * Copyright (C) 2003-2007 Wayne Davison * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + * with this program; if not, visit the http://fsf.org website. */ /* Rsync provides its own multiplexing system, which is used to send @@ -445,13 +445,13 @@ static void decrement_flist_in_progress(int ndx, int redo) rprintf(FERROR, "Invalid file index: %d (%d - %d) [%s]\n", ndx, first_flist->ndx_start, - first_flist->prev->ndx_start + first_flist->prev->count - 1, + first_flist->prev->ndx_start + first_flist->prev->used - 1, who_am_i()); exit_cleanup(RERR_PROTOCOL); } flist = flist->prev; } - while (ndx >= flist->ndx_start + flist->count) { + while (ndx >= flist->ndx_start + flist->used) { if (!(flist = flist->next)) goto invalid_ndx; } @@ -677,7 +677,7 @@ static int read_timeout(int fd, char *buf, size_t len) io_filesfrom_bp = io_filesfrom_buf; else io_filesfrom_bp += l; - } else { + } else if (errno != EINTR) { /* XXX should we complain? */ io_filesfrom_f_out = -1; } @@ -688,11 +688,13 @@ static int read_timeout(int fd, char *buf, size_t len) io_filesfrom_buf, sizeof io_filesfrom_buf); if (l <= 0) { - /* Send end-of-file marker */ - io_filesfrom_buf[0] = '\0'; - io_filesfrom_buf[1] = '\0'; - io_filesfrom_buflen = io_filesfrom_lastchar? 2 : 1; - io_filesfrom_f_in = -1; + if (l == 0 || errno != EINTR) { + /* Send end-of-file marker */ + io_filesfrom_buf[0] = '\0'; + io_filesfrom_buf[1] = '\0'; + io_filesfrom_buflen = io_filesfrom_lastchar? 2 : 1; + io_filesfrom_f_in = -1; + } } else { if (!eol_nulls) { char *s = io_filesfrom_buf + l; @@ -875,7 +877,7 @@ void maybe_send_keepalive(void) if (protocol_version >= 30) send_msg(MSG_NOOP, "", 0, 0); else { - write_int(sock_f_out, cur_flist->count); + write_int(sock_f_out, cur_flist->used); write_shortint(sock_f_out, ITEM_IS_NEW); } }