On Wed, 2022-11-23 at 09:57 +0100, Florian Weimer via Libc-help wrote: > Fork still shares the underlying file description.  It only duplicates > the descriptors.  If the subprocess changes the file pointer back to 0, > it will affect the original process, too.  This is just how file > descriptors work. > > Could this explain the issue? That does sound like what the symptoms would indicate. However it doesn't seem to fit, because the first thing the child process does is call freopen(), which should in theory close the descriptor and then create a new file descriptor and file description? On the other hand, the fact that using fclose()+fopen() instead of freopen() does seem to fix the problem, seems to indicate that freopen() is not actually successfully closing the descriptor and thus the file pointer is shared between processes? -- bye, pabs https://bonedaddy.net/pabs3/