capmt: fix endless loop

When tvh receives less then 4 bytes from the socket for some reason,
it stuck in the endless loop in handle_single() calling:
capmt_msg_size()
capmt_analyze_cmd()
The capmt thread eats 100% CPU and cannot be normally terminated
because the capmt_msg_size() was constantly returning 0.

The commit fixes the problem.
This commit is contained in:
Mariusz Bialonczyk 2015-03-13 13:16:53 +01:00 committed by Jaroslav Kysela
parent 7414ebafe4
commit ac3599bc79

View file

@ -1372,7 +1372,7 @@ handle_single(capmt_t *capmt)
}
if (adapter < MAX_CA) {
cmd_size = capmt_msg_size(capmt, &buffer, offset);
if (cmd_size >= 0)
if (cmd_size > 0)
break;
}
sbuf_cut(&buffer, 1);