From: Martin Mares Date: Fri, 12 Mar 2004 13:54:46 +0000 (+0000) Subject: Seek to end of an empty fbmem stream needs a special exception. X-Git-Tag: holmes-import~1100 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=15e46da83c62468aa2a7f2396ad9280f79a30e99;p=libucw.git Seek to end of an empty fbmem stream needs a special exception. --- diff --git a/lib/fb-mem.c b/lib/fb-mem.c index 2b0d7e94..daa80733 100644 --- a/lib/fb-mem.c +++ b/lib/fb-mem.c @@ -120,6 +120,14 @@ fbmem_seek(struct fastbuf *f, sh_off_t pos, int whence) return; } } + if (!m->first && !pos) + { + /* Seeking to offset 0 in an empty file needs an exception */ + f->buffer = f->bptr = f->bufend = NULL; + f->pos = 0; + FB_MEM(f)->block = NULL; + return; + } die("fbmem_seek to invalid offset"); }