From: Wayne Davison Date: Mon, 16 Sep 2013 16:00:53 +0000 (-0700) Subject: Fix error in write_sparse() on incomplete write. X-Git-Tag: v3.1.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d7538d43c360750b6dd13019eb07c914d880bd8;p=thirdparty%2Frsync.git Fix error in write_sparse() on incomplete write. Fix a problem where sparse_seek could get left non-zero when we did not finish writing all the data that would take us to that sparse gap. Issue pointed out by David Taylor. --- diff --git a/fileio.c b/fileio.c index 0e207141..78decee9 100644 --- a/fileio.c +++ b/fileio.c @@ -84,11 +84,14 @@ static int write_sparse(int f, char *buf, int len) while ((ret = write(f, buf + l1, len - (l1+l2))) <= 0) { if (ret < 0 && errno == EINTR) continue; + sparse_seek = 0; return ret; } - if (ret != (int)(len - (l1+l2))) + if (ret != (int)(len - (l1+l2))) { + sparse_seek = 0; return l1+ret; + } return len; }