handle interrupted system calls

added code to handle EINTR