is this a bug in glibc or readpst?

Paul Wise pabs3@bonedaddy.net
Thu Nov 24 00:06:41 GMT 2022


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://sourceware.org/pipermail/libc-help/attachments/20221124/0a3fa9fb/attachment.sig>


More information about the Libc-help mailing list