[Serdev] off-by-one error in config part of gflags module

Michal Matyska michal at iptel.org
Thu Jan 4 18:05:04 UTC 2007


If the intetion of the last command was to clear the gflag(1), then you
should use:


$ ./sercmd gflags.reset 1
$ ./sercmd gflags.dump | head -2
0
0


the argument of the gflags.{set|reset} call is the bit number (the same
number which is used in the ser.cfg is_gflag(x) parameter)

Michal

On Thu, 2007-01-04 at 14:13 +0100, Hendrik Scholz wrote:
> Hi!
> 
> I intended to protect a code block using is_gflag() on a post-Ottendorf
> SER but ran into an off by one bug:
> 
> Inside ser.cfg I check for gflag 1:
> if (is_gflag(1)) { ... }
> 
> After startup is_gflag() fails as expected. Now I set flag '1':
> 
>   # sercmd gflags.dump | head -2
>   0
>   0
>   # sercmd gflags.set 1
>   # sercmd gflags.dump | head -2
>   0
>   1
>   #
> 
> At this point the code block is not executed but if I go ahead
> and set flag '0' is for sure is:
> 
>   # sercmd gflags.set 0
>   # sercmd gflags.dump | head -2
>   1
>   1
>   #
> 
> I don't have the time to dig into this but it's not what I expect
> it to do ;)
> 
> Cheers,
>  Hendrik
> 
> P.S.: tracker.iptel.org doesn't like me right now therefore I'll
>       file the bug later.
> 



More information about the Serdev mailing list