[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in st
Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()
Fri, 27 Apr 2012 11:10:43 -0300
On Fri, 27 Apr 2012 08:07:20 -0600
Eric Blake <address@hidden> wrote:
> On 04/26/2012 05:18 PM, Luiz Capitulino wrote:
> >> Not quite right. ULLONG_MAX is a valid return, but you did not prime
> >> errno, so if errno has junk ERANGE from some earlier point in the
> >> program, you will have a false negative. You are guaranteed that errno
> >> is unchanged on success, so prime things by setting errno to 0 before
> >> calling strtoull.
> > I thought about doing that but - hope that won't sound stupid - how can I
> > guarantee that ERANGE is not 0?
> Because POSIX requires that all E* constants are positive numbers,
> reserving errno of 0 for success.
Yeah, I read about that a few hours later. But thanks anyway!
[Qemu-devel] [PATCH 2/2] hmp: fix bad value conversion for M type, Luiz Capitulino, 2012/04/26