As I said earlier, I'm a little uncomfortable blanket applying this to *all* file descriptors. We are only aware of this problem in connection with the stdout file descriptors.

Additionally, I think the interface may need to be tweaked slightly. The errno of the read/write syscall is currently overwritten when fcntl fails. I also think that this shouldn't cause an infinite loop, I would expect this to not retry if O_NONBLOCK wasn't set before, and I would only expect it to retry once afterwards. Is there a reason to continually try?