check for EINTR to avoid spinning in an empty file

(cherry picked from commit 04011143f8d56aab0eaf7ae3b1e70c27adbaa8f3)