[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libcdio-devel] [bug #18131] "make check" sometimes fails on some pl
From: |
Steven M. Schultz |
Subject: |
Re: [Libcdio-devel] [bug #18131] "make check" sometimes fails on some platforms (for example, Mac OS X 10.4.8). |
Date: |
Fri, 27 Oct 2006 13:13:11 -0700 (PDT) |
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