On Fri, 27 Oct 2006, R. Bernstein wrote:

> Any comments about this? Interestingly, I tested "make check" on OS X.

        There may or may not be a bug.  However, resetting errno is NOT
        the correct thing to do.

>  > "make check" sometimes fails on some platforms (for example, Mac OS X
>  > 10.4.8).
>  > Please reset errno before strtol().

        The code should check for the specific values returned by strtol()
        that signify errno being valid.

        From strtol(1):

     "If an underflow occurs, strtol() returns LONG_MIN and strtoll() returns 
     QUAD_MIN. If an overflow occurs, strtol() returns LONG_MAX and strtoll() 
     returns QUAD_MAX. In both cases, errno is set to ERANGE."

     errno is only 'valid' (i.e. can be tested for being non-zero) if the
     function has returned LONG_MAX, LONG_MIN or QUAD_MIN.  If neither of
     those is returned then errno is undefined.

     It's the same thing as for write() and read() - errno only has meaning
     if -1 is returned.

     Cheers,
     Steven Schultz



_______________________________________________
Libcdio-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/libcdio-devel

Reply via email to