check for EINTR to avoid spinning in an empty file