From: Martin Mares Date: Wed, 5 Nov 2003 20:43:27 +0000 (+0000) Subject: bbcopy() can be asked to copy the rest of the input file by specifying X-Git-Tag: holmes-import~1167 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=49798253e0734806ffc02b11056a96da186a1bd6;p=libucw.git bbcopy() can be asked to copy the rest of the input file by specifying a length of ~0U. --- diff --git a/lib/fastbuf.c b/lib/fastbuf.c index 50b869a8..0929f101 100644 --- a/lib/fastbuf.c +++ b/lib/fastbuf.c @@ -314,14 +314,19 @@ bbcopy_slow(struct fastbuf *f, struct fastbuf *t, uns l) favail = bdirect_read_prepare(f, &fptr); if (!favail) - die("bbcopy: source exhausted"); + { + if (l == ~0U) + return; + die("bbcopy: source exhausted"); + } tavail = bdirect_write_prepare(t, &tptr); n = MIN(l, favail); n = MIN(n, tavail); memcpy(tptr, fptr, n); bdirect_read_commit(f, fptr + n); bdirect_write_commit(t, tptr + n); - l -= n; + if (l != ~0U) + l -= n; } }