X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/7c573428a988d70c1bb203bc6325520dd244aadc..650bca3770956c03ae793428be3ff4ed303ccba7:/receiver.c diff --git a/receiver.c b/receiver.c index 1fe2fe15..1aba494c 100644 --- a/receiver.c +++ b/receiver.c @@ -3,7 +3,7 @@ * * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2003-2008 Wayne Davison + * Copyright (C) 2003-2009 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -285,8 +285,11 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, goto report_write_error; #ifdef HAVE_FTRUNCATE - if (inplace && fd != -1) - ftruncate(fd, offset); + if (inplace && fd != -1 + && ftruncate(fd, offset) < 0) { + rsyserr(FERROR_XFER, errno, "ftruncate failed on %s", + full_fname(fname)); + } #endif if (do_progress) @@ -383,15 +386,23 @@ static int we_want_redo(int desired_ndx) static int gen_wants_ndx(int desired_ndx) { static int next_ndx = -1; - static BOOL got_eof = 0; + static int done_cnt = 0; + static BOOL got_eof = False; + int flist_num = first_flist->flist_num; if (got_eof) return 0; while (next_ndx < desired_ndx) { + if (inc_recurse && flist_num <= done_cnt) + return 0; if (next_ndx >= 0) no_batched_update(next_ndx, False); if ((next_ndx = read_int(batch_gen_fd)) < 0) { + if (inc_recurse) { + done_cnt++; + continue; + } got_eof = True; return 0; }