]> mj.ucw.cz Git - libucw.git/commitdiff
bbcopy() can be asked to copy the rest of the input file by specifying
authorMartin Mares <mj@ucw.cz>
Wed, 5 Nov 2003 20:43:27 +0000 (20:43 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 5 Nov 2003 20:43:27 +0000 (20:43 +0000)
a length of ~0U.

lib/fastbuf.c

index 50b869a88ff39b086f5e09a952703f7ddb494a48..0929f101a9c8a959bda89abe1c892711fe643051 100644 (file)
@@ -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;
     }
 }