Skip site navigation (1)Skip section navigation (2)
Date:      20 Aug 2002 22:22:55 +1000
From:      Andrew Reilly <areilly@bigpond.net.au>
To:        Erik Trulsson <ertr1013@student.uu.se>
Cc:        Bill Vermillion <bv@wjv.com>, stable@FreeBSD.ORG, ports@FreeBSD.ORG
Subject:   Re: A but in Zoo
Message-ID:  <1029846175.26839.25.camel@gurney.reilly.home>
In-Reply-To: <20020814130031.GA58489@falcon.midgard.homeip.net>
References:  <bulk.34340.20020814013822@hub.freebsd.org> <20020814114442.GA77130@wjv.com>  <20020814130031.GA58489@falcon.midgard.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2002-08-14 at 23:00, Erik Trulsson wrote:
> A quick investigation indicates that this is a bug in zoo.  
> It presumably was not exposed on earlier versions of FreeBSD.
> 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);

Rather than changing the source like this, wouldn't it be much better,
more portable and above all neater just to make sure that the prototype
for lseek() was in scope at that point, so that the 0L could be promoted
automatically and correctly by the compiler?  (I.e., #include <unistd.h>
somewhere above.)

In fact, with the prototype in scope, I'd be tempted to change the 2nd
arg from 0L to just 0, and be done with it.

Hmm.  Looking at the header files just now, it seems that the
declaration of lseek is conditional on a symbol _LSEEK_DECLARED, which
is defined in both unistd.h and stdio.h (where it is, in turn,
conditional on _ANSI_SOURCE and _POSIX_SOURCE).

-- 
Andrew


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?1029846175.26839.25.camel>