weird problem with (fseek/ftell/fwrite/putc)

weird problem with (fseek/ftell/fwrite/putc)

Post by Gregor Schm » Thu, 04 Jun 1992 20:33:06

as I tried to compile zoo using gcc 2.11c / linux 0.96a & patch1
I got a problem which I tracked down to the following:

when adding a file to an archive zoo first creates an empty directory
entry in the archive, then compresses the file and stores it and then
fseeks back to the position of the directory entry and overwrites it.

This works fine with standard compression.

If high compression is used, the compressed file is not stored using
blocktype read/write operations, but using putc. I inserted an ftell
into the code after the following fseek, which reports the right
position. Nevertheless the following fwrite doesn't go there, but
on the next 1024 bytes boundary. No need to say that this corrupts
the archive.

If this is a bug, is it in the gcc libraries or in the kernel?
Is there any immediate fix? I would like the zoo high compression
to work reliably to use zoo for my backups.

Thanks for 'listening',