[Toybox] [PATCH] tail fixes

Felix Janda felix.janda at posteo.de
Sat Sep 7 13:39:41 PDT 2013


> > >    // If lseek() doesn't work on this stream, return now.
> > > -  if (pos<0) return 0;
> > > +  if (pos == -1) return 0;
> > 
> > And yet you compare it with a negative. Maybe the bit patterns work  
> > out, but I'm uncomfortable with that. I can see a compiler optimizing  
> > this out simply because it can never be true. (That's actually what  
> > happens when pos is unsigned char, due to type promotion.)
> 
> You are right. It should be -1u. (This can only be optimized out if

Oh, it should rather be (size_t)-1.

 1378586381.0


More information about the Toybox mailing list