Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Aug 2002 19:16:44 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        naddy@mips.inka.de (Christian Weisgerber)
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Re: A but in Zoo
Message-ID:  <20020814191644.A8549@student.uu.se>
In-Reply-To: <ajdvpo$19r7$1@kemoauc.mips.inka.de>; from naddy@mips.inka.de on Wed, Aug 14, 2002 at 04:16:56PM %2B0000
References:  <bulk.34340.20020814013822@hub.freebsd.org> <20020814114442.GA77130@wjv.com> <20020814130031.GA58489@falcon.midgard.homeip.net> <ajdvpo$19r7$1@kemoauc.mips.inka.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 14, 2002 at 04:16:56PM +0000, Christian Weisgerber wrote:
> Erik Trulsson <ertr1013@student.uu.se> wrote:
> 
> > To be more precise the function zootrunc() which can be found at the
> > end of the file bsd.c contains a line
> > 
> >         seekpos = lseek(fd, 0L, SEEK_CUR);
> > 
> > This should be changed to
> > 
> >         seekpos = lseek(fd, (off_t) 0L, SEEK_CUR);
> 
> If the compiler has seen the prototype for lseek(), it will perform that
> cast automatically.  If the prototype hasn't been included at that
> point, then the fix is to fetch it: #include <unistd.h>.

<unistd.h> is included and since the change above makes things work the
cast is obviously not performed automatically.

Some more investigation shows that the real error apparently is that the
program attempts to declare lseek() itself as

  off_t lseek();

after the #include <unistd.h>
This declaration apparently overrides the prototype from unistd.h and
breaks things.  (The ironic thing here is that declaration above is what
the source does after applying the patches from the port. The original
source doesn't include unistd.h and declares lseek() as 
  long lseek();
instead. This is obviously not correct for FreeBSD, but the patches
currently in the port didn't really fix this.)

So the "correct" fix is to remove the declaration of lseek() from the
zootrunc() function instead, but my original change works fine.

Either of the changes to zootrunc() (removing the declaration of lseek() or
changing the invocation of lseek()) will make the code correct, although
the former is arguably a "better" fix.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020814191644.A8549>