From 49798253e0734806ffc02b11056a96da186a1bd6 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 5 Nov 2003 20:43:27 +0000 Subject: [PATCH] bbcopy() can be asked to copy the rest of the input file by specifying a length of ~0U. --- lib/fastbuf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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; } } -- 2.39.5