From: Martin Mares Date: Tue, 6 Jul 2004 10:24:21 +0000 (+0000) Subject: fb-limfd was setting can_overwrite_buffer=2, but it forgot to do the buffer X-Git-Tag: holmes-import~973 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a31c9ba7f87d6b95faa12d09e7f970ed6780003d;p=libucw.git fb-limfd was setting can_overwrite_buffer=2, but it forgot to do the buffer resetting magic needed by bdirect_read_commit_modified(). --- diff --git a/lib/fb-limfd.c b/lib/fb-limfd.c index 4302bc35..351f0032 100644 --- a/lib/fb-limfd.c +++ b/lib/fb-limfd.c @@ -1,7 +1,7 @@ /* * Sherlock Library -- Fast Buffered Input on Limited File Descriptors * - * (c) 2003 Martin Mares + * (c) 2003--2004 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -19,15 +19,16 @@ struct fb_limfd { int limit; }; #define FB_LIMFD(f) ((struct fb_limfd *)(f)->is_fastbuf) +#define FB_BUFFER(f) (byte *)(FB_LIMFD(f) + 1) static int bfl_refill(struct fastbuf *f) { + f->bptr = f->buffer = FB_BUFFER(f); int max = MIN(FB_LIMFD(f)->limit - f->pos, f->bufend - f->buffer); int l = read(FB_LIMFD(f)->fd, f->buffer, max); if (l < 0) die("Error reading %s: %m", f->name); - f->bptr = f->buffer; f->bstop = f->buffer + l; f->pos += l; return l;