1 diff -urN poldek-0.18.8.org/pkgfl.c poldek-0.18.8/pkgfl.c
2 --- poldek-0.18.8.org/pkgfl.c 2004-12-30 13:05:22.000000000 +0100
3 +++ poldek-0.18.8/pkgfl.c 2005-04-21 22:06:58.126819592 +0200
11 if (fread(&size, sizeof(size), 1, stream) != 1)
14 fl = pkgfl_restore(&nbufi, dirs, include);
17 - fseek(stream, 1, SEEK_CUR); /* skip final '\n' */
18 + fread(&dummy, 1, 1, stream); /* skip final '\n' */
23 int pkgfl_skip_f(FILE *stream)
28 if (fread(&size, sizeof(size), 1, stream) != 1)
32 - fseek(stream, size + 1, SEEK_CUR);
33 + buf = malloc(size + 1);
35 + fread(buf, 1, size + 1, stream);
37 + fseek(stream, size + 1, SEEK_CUR);
42 diff -urN poldek-0.18.8.org/pkgu.c poldek-0.18.8/pkgu.c
43 --- poldek-0.18.8.org/pkgu.c 2002-05-15 17:42:48.000000000 +0200
44 +++ poldek-0.18.8/pkgu.c 2005-04-21 22:04:22.641456960 +0200
47 uint16_t nsize, nlangs;
49 - fseek(stream, sizeof(nlangs), SEEK_CUR);
50 - if (fread(&nsize, sizeof(nsize), 1, stream) != 1) {
51 + if ((fread(&nlangs, sizeof(nlangs), 1, stream) != 1) ||
52 + (fread(&nsize, sizeof(nsize), 1, stream) != 1)) {
55 nsize = ntoh16(nsize);
56 diff -urN poldek-0.18.8.org/trurlib/nstream.c poldek-0.18.8/trurlib/nstream.c
57 --- poldek-0.18.8.org/trurlib/nstream.c 2004-05-06 09:57:45.000000000 +0200
58 +++ poldek-0.18.8/trurlib/nstream.c 2005-04-21 22:04:22.622459848 +0200
60 z_off_t rc, off = *offset;
62 rc = gzseek(stream, off, whence);
69 printf("zfseek (%p, %ld, %lld, %d) = %d\n", stream, off, *offset, whence, rc);
75 - fseek(st->stream, 0, SEEK_SET); /* glibc BUG (?) */
76 + fseek(st->stream, 0, SEEK_SET); /* XXX glibc BUG (?) */
80 diff -urN poldek-0.18.8.org/vfile/vfile.c poldek-0.18.8/vfile/vfile.c
81 --- poldek-0.18.8.org/vfile/vfile.c 2004-02-26 19:22:28.000000000 +0100
82 +++ poldek-0.18.8/vfile/vfile.c 2005-04-21 22:04:22.630458632 +0200
84 z_off_t rc, off = *offset;
86 rc = gzseek(stream, off, whence);
93 printf("zfseek (%p, %ld, %lld, %d) = %d\n", stream, off, *offset, whence, rc);
96 vf->vf_stream = fopencookie(gzstream, mode, gzio_cookie);
97 if (vf->vf_stream != NULL) {
99 - fseek(vf->vf_stream, 0, SEEK_SET); /* glibc BUG (?) */
100 + vf->vf_buf = malloc(128); /* use small buffer to avoid reverse gzseeks on small forward fseeks */
101 + if(vf->vf_buf == NULL)
102 + vfile_err_fn("buffer malloc failed for %s\n", CL_URL(path));
104 + if(setvbuf(vf->vf_stream, vf->vf_buf, _IOFBF, 128) != 0) {
105 + vfile_err_fn("setvbuf failed for %s\n", CL_URL(path));
109 + fseek(vf->vf_stream, 0, SEEK_SET); /* XXX glibc BUG (?) */
111 vfile_err_fn("fopencookie %s: hgw error\n", CL_URL(path));
119 urltype = vf_url_type(path);
123 vf->vf_tmpath = NULL;
127 memset(vf, 0, sizeof(*vf));
130 diff -urN poldek-0.18.8.org/vfile/vfile.h poldek-0.18.8/vfile/vfile.h
131 --- poldek-0.18.8.org/vfile/vfile.h 2004-06-08 15:57:03.000000000 +0200
132 +++ poldek-0.18.8/vfile/vfile.h 2005-04-21 22:04:22.634458024 +0200