tom kronmiller wrote:
> I ended up using setvbuf(stdin, NULL, _IONBF, 0) in the parent process and
> that seems to have fixed the actual program I was having trouble with.
thomas schmitt asked:
stdin ? Not setvbuf(stdout, NULL, _IONBF, 0) ?
Yes, stdin. The problem I was having was stdin getting repeated endlessly, so I unbuffered stdin and that seemed to make it happy. I'm guessing that the exit of the child process is doing a fflush(stdin) which is causing the file descriptor to get rewound so that the parent process gets that stdin data again. But maybe this is nonsensical, I just observed that unbuffering stdin made my toy program and the original program it's extracted from work as expected.