1 --- poldek-0.18.8/trurlib/nstream.c.orig 2004-05-06 09:57:45.000000000 +0200
2 +++ poldek-0.18.8/trurlib/nstream.c 2005-04-12 10:42:44.000000000 +0200
4 z_off_t rc, off = *offset;
6 rc = gzseek(stream, off, whence);
13 printf("zfseek (%p, %ld, %lld, %d) = %d\n", stream, off, *offset, whence, rc);
19 - fseek(st->stream, 0, SEEK_SET); /* glibc BUG (?) */
20 + fseek(st->stream, 0, SEEK_SET); /* XXX glibc BUG (?) */
24 --- poldek-0.18.8/vfile/vfile.c.orig 2005-04-07 15:38:06.000000000 +0200
25 +++ poldek-0.18.8/vfile/vfile.c 2005-04-12 10:36:43.000000000 +0200
27 z_off_t rc, off = *offset;
29 rc = gzseek(stream, off, whence);
36 printf("zfseek (%p, %ld, %lld, %d) = %d\n", stream, off, *offset, whence, rc);
39 vf->vf_stream = fopencookie(gzstream, mode, gzio_cookie);
40 if (vf->vf_stream != NULL) {
42 - fseek(vf->vf_stream, 0, SEEK_SET); /* glibc BUG (?) */
43 + vf->vf_buf = malloc(128); /* use small buffer to avoid reverse gzseeks on small forward fseeks */
44 + if(vf->vf_buf == NULL)
45 + vfile_err_fn("buffer malloc failed for %s\n", CL_URL(path));
47 + if(setvbuf(vf->vf_stream, vf->vf_buf, _IOFBF, 128) != 0) {
48 + vfile_err_fn("setvbuf failed for %s\n", CL_URL(path));
52 + fseek(vf->vf_stream, 0, SEEK_SET); /* XXX glibc BUG (?) */
54 vfile_err_fn("fopencookie %s: hgw error\n", CL_URL(path));
62 urltype = vf_url_type(path);
70 memset(vf, 0, sizeof(*vf));
73 --- poldek-0.18.8/vfile/vfile.h.orig 2005-04-07 15:38:06.000000000 +0200
74 +++ poldek-0.18.8/vfile/vfile.h 2005-04-12 10:36:43.000000000 +0200
83 --- poldek-0.18.8/pkgfl.c.orig 2004-12-30 13:05:22.000000000 +0100
84 +++ poldek-0.18.8/pkgfl.c 2005-04-12 09:47:22.000000000 +0200
92 if (fread(&size, sizeof(size), 1, stream) != 1)
95 fl = pkgfl_restore(&nbufi, dirs, include);
98 - fseek(stream, 1, SEEK_CUR); /* skip final '\n' */
99 + fread(&dummy, 1, 1, stream); /* skip final '\n' */
103 --- poldek-0.18.8/pkgu.c.orig 2002-05-15 17:42:48.000000000 +0200
104 +++ poldek-0.18.8/pkgu.c 2005-04-12 09:52:45.000000000 +0200
107 uint16_t nsize, nlangs;
109 - fseek(stream, sizeof(nlangs), SEEK_CUR);
110 - if (fread(&nsize, sizeof(nsize), 1, stream) != 1) {
111 + if ((fread(&nlangs, sizeof(nlangs), 1, stream) != 1) ||
112 + (fread(&nsize, sizeof(nsize), 1, stream) != 1)) {
115 nsize = ntoh16(nsize);
116 diff -urN poldek-0.18.8.org/pkgfl.c poldek-0.18.8/pkgfl.c
117 --- poldek-0.18.8.org/pkgfl.c 2004-12-30 13:05:22.000000000 +0100
118 +++ poldek-0.18.8/pkgfl.c 2005-04-20 23:21:45.000000000 +0200
119 @@ -557,12 +557,15 @@
120 int pkgfl_skip_f(FILE *stream)
125 if (fread(&size, sizeof(size), 1, stream) != 1)
129 - fseek(stream, size + 1, SEEK_CUR);
130 + /* skip size + 1 bytes */
131 + buf = alloca(size + 1);
132 + fread(buf, 1, size + 1, stream);