Retry if open(2) is interrupted; set the CLOEXEC flag as well.
Also retry if read(2) returns EAGAIN. This shouldn't happen in blocking mode,
but it can't hurt either.