httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@devsys.jaguNET.com>
Subject Re: [PATCH] Error logging in http_core.c: extra info, fseek()
Date Sun, 07 Mar 1999 19:20:48 GMT
John Bley wrote:
> 
> On Sun, 7 Mar 1999, Roy T. Fielding wrote:
> 
> > >+		    if (fseek(f, offset, SEEK_SET))
> > I'm all for adding more error detection stuff, but the comparison should be
> > 
> >    if (fseek(f, offset, SEEK_SET) == -1)
> > 
> > since that is more reliable across platforms than a return of only zero
> > on success.  The same is true of other system calls (look at the man page
> > to see what is defined as "RETURN VALUES").
> 
> Hmmm.. you learn something new everyday.  So "-1 for error" is more 
> portable than "non-zero for error"?  OK, I'll make sure to follow that 
> pattern.  Should I then assume that existing code which makes this 
> same mistake should be corrected?
> 

Nope... in fact, just the opposite. non-0 is, at least for fseek(), more
portable. Some systems (FreeBSD for example) specifically state -1
is an error, but others (as well as Ansi-K&R) just state non-zero.

-- 
===========================================================================
   Jim Jagielski   |||   jim@jaguNET.com   |||   http://www.jaguNET.com/
            "That's no ordinary rabbit... that's the most foul,
            cruel and bad-tempered rodent you ever laid eyes on"

Mime
View raw message