public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Paul Wise <pabs3@bonedaddy.net>
To: Florian Weimer <fweimer@redhat.com>,
	Libc-help <libc-help@sourceware.org>
Subject: Re: is this a bug in glibc or readpst?
Date: Thu, 24 Nov 2022 08:06:41 +0800	[thread overview]
Message-ID: <d64838c66a1e7a4f9ea849d41929b6edbec5567f.camel@bonedaddy.net> (raw)
In-Reply-To: <875yf6nj43.fsf@oldenburg.str.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

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/

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-11-24  0:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  2:02 Paul Wise
2022-11-23  8:57 ` Florian Weimer
2022-11-24  0:06   ` Paul Wise [this message]
2022-12-02 17:37     ` Florian Weimer
2023-08-06  6:07       ` Paul Wise
2023-08-07  8:59         ` Florian Weimer
2023-08-07 11:00           ` Paul Wise
2023-08-07 11:46             ` Florian Weimer
2023-08-07 11:58               ` Paul Wise

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d64838c66a1e7a4f9ea849d41929b6edbec5567f.camel@bonedaddy.net \
    --to=pabs3@bonedaddy.net \
    --cc=fweimer@redhat.com \
    --cc=libc-help@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).