[Nut-upsdev] [PATCH] Fix logic error in rhino driver

Arnaud Quette aquette.dev at gmail.com
Sat Nov 12 14:31:10 UTC 2011


Hi Silvino,

could you please check the below thread?
Your lights on this would be much appreciated.

thanks,
Arnaud

2011/11/3 Thomas Jarosch <thomas.jarosch at intra2net.com>

> On Saturday, 15. October 2011 09:10:18 Arnaud Quette wrote:
> > >>> Detected by "cppcheck", not tested on real hardware.
> > >>>
> > >>> -      if(  ( BattVoltage > 129 ) || ( BattVoltage < 144 ) )
> > >>> +      if(  ( BattVoltage > 129 ) && ( BattVoltage < 144 ) )
> > >>
> > >>   I think the current, ||, logic is fine.  I can't see in what
> > >> circumstances it would yield the wrong decision.  Can anyone point a
> > >> scenario where I am wrong?
> > >
> > > As the diagnostic says, it is always true.  No matter what value
> > > BattVoltage takes, whether float or int,
> > > it is always either > 129 or < 144.   It is clearly a bug, but we
> > > aren't sure whether it should be
> > > in range, out of range, or just remove the test altogether (since it
> > > seems to work when always true).
> >
> > the best thing to do, in such case, remains to contact the author.
> >
> > @Silvino: could you please check this thread and give us back your
> > opinion? http://blog.gmane.org/gmane.comp.monitoring.nut.devel
>
> ping.
>
> Cheers,
> Thomas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20111112/f232240a/attachment.html>


More information about the Nut-upsdev mailing list