Fix invalid cast from long to int, causing a compare operation to always return FALSE.

This resulted in the main loop being indefinitely stuck into write() into a file descriptor.
28 jobs for master
in 0 seconds and was queued for 0 seconds