I've noticed that my C++ application stops printing to stdout after a while, and I didn't know why. It turns out that printing via 'std::ostream::operator<<' will eventually call '__stdio_write()', which then calls 'writev()'. But, if 'writev()' is interrupted by a signal and SA_RESTART is not set, then it will return EINTR, which will cause both the 'FILE' structure and the corresponding C++ stream to be marked bad. I think the current behavior is very confusing, so attached is a patch to retry on EINTR. Thanks, Dominic