fixed inappropriate comparison.

A variable 'timeout' is size_t (i.e. unsigned). But the code
comapares it to the negative value (or zero).