[BusyBox] seek_sub_file in unarchive.c broken?

Matt Kraai kraai at alumni.carnegiemellon.edu
Fri Sep 21 19:56:25 UTC 2001

On Fri, Sep 21, 2001 at 06:16:16PM -0700, Stefan Soucek wrote:
> Ah yes, I mixed this up. So my analysis on lseek is wrong here. I tried
> your patch and the problem still prevails. The case I observe is that
> count=17 and fseek() returns -1 (ESPIPE). When I step through fseek(),
> the expression
> if ((fp->mode & __MODE_ERR) || 
>     (((ref != SEEK_CUR) || offset) && (lseek(fp->fd, offset, ref) < 0)))
> is true and the function returns actually with '-1' just before the code
> you suggested to add in the patch. So I figure the bufpos is still not
> set correctly.

Have you tested dpkg, or just stepped through the code?  The call
to fseek(3) should leave the buffer unchanged if the lseek(2) call
fails.  This should allow the fallback method, reading count bytes
via fgetc(3), to work.


More information about the busybox mailing list