I don't think the (errno == EINTR) check needs a sleep. So that check can be done in a nested do..while loop that simply calls open() until the errno is not EINTR.