Export to GitHub

btstack - issue #355

a little bug in function posix_execute()


Posted on Nov 7, 2013 by Swift Rabbit

Related code as follows: while (next_tv.tv_usec < 0){ next_tv.tv_usec += 1000000; next_tv.tv_sec--; } if (next_tv.tv_sec < 0 || (next_tv.tv_sec == 0 && next_tv.tv_usec < 0)){ next_tv.tv_sec = 0; next_tv.tv_usec = 0; }

the "while" line ensure "next_tv.tv_usec >= 0", so, the "next_tv.tv_usec < 0" judgement on "if" line may never be true.

the correct line may as follows: if (next_tv.tv_sec < 0 || (next_tv.tv_sec == 0 && next_tv.tv_usec == 0)){

Comment #1

Posted on Dec 19, 2013 by Swift Ox

that's correct. the whole second part is then useless. see commit 2011. thanks!

Status: Fixed

Labels:
Type-Defect Priority-Medium