fixing errno 4 when interrupting select