qemu-devel
[Top][All Lists]
Advanced

[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


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()
Date: Thu, 26 Apr 2012 20:29:00 -0300

On Thu, 26 Apr 2012 20:19:42 -0300
Luiz Capitulino <address@hidden> wrote:

> On Thu, 26 Apr 2012 20:18:02 -0300
> Luiz Capitulino <address@hidden> 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?
> 
> Oh, that _was_ stupid. errno=0 is actually recommended in the documentation,
> will change.

Oh, and now I read that you wrote just that above. Dude, it's not a good idea
to answer emails while waiting for your food to come...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]