Bogus rsync "Success" message when out of disk space
jw schultz
jw at pegasys.ws
Fri May 23 09:25:33 EST 2003
Committed with block comment for whole function.
On Sat, Apr 26, 2003 at 03:09:29PM -0500, John Van Essen wrote:
> Upon further (belated) investigation, there are 2 affected places
> in receiver.c with this error message. Both call write_file().
> And write_file is called only in those two places. So that is the
> appropriate location to patch. Especially since the obvious fix is
> to use the rewrite code already there for the sparse file writes.
>
> -------------------------------------8<-------------------------------------
> --- fileio.c.orig Fri Jan 25 15:07:34 2002
> +++ fileio.c Sat Apr 26 12:16:25 2003
> @@ -69,25 +69,28 @@
> return len;
> }
>
>
>
> int write_file(int f,char *buf,size_t len)
> {
> int ret = 0;
>
> - if (!sparse_files) {
> - return write(f,buf,len);
> - }
> -
> while (len>0) {
> - int len1 = MIN(len, SPARSE_WRITE_SIZE);
> - int r1 = write_sparse(f, buf, len1);
> + int r1;
> + if (sparse_files) {
> + int len1 = MIN(len, SPARSE_WRITE_SIZE);
> + r1 = write_sparse(f, buf, len1);
> + } else {
> + /* Normal writes are in this loop, too, so that */
> + /* retries of partial writes will set errno. */
> + r1 = write(f, buf, len);
> + }
> if (r1 <= 0) {
> if (ret > 0) return ret;
> return r1;
> }
> len -= r1;
> buf += r1;
> ret += r1;
> }
> return ret;
More information about the rsync
mailing list