On 3/2/06, Per Jessen <per@computer.org> wrote:
OK, for the benefit of others listening in, this is what I've briefly described to Steve and Anders on suse-linux-e - who both said "it's impossible" - which I agree with. Reality however seems to be of a different opinion.
<snip> Per, did not have time to take a closer look at your code, but I think that fputs(3) itself is not the culprit since it does not necessarily set errno when EOF is encountered (write(2) on the other hand, which is called on behalf of fputs(2), does). Instead you're duplicating the FDs before associating it with a stream and the call to fcntl(2) call causes the other (new) FD to be put into non-blocking (O_NONBLOCK) as well since the data structures in the kernel are shared among them. \Steve