All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Dirk Gouders <dirk@gouders.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-kernel@vger.kernel.org, linux-newbie@vger.kernel.org
Subject: Re: pty: childs don't always react on close(2)
Date: Fri, 5 Dec 2025 21:48:52 +0000	[thread overview]
Message-ID: <20251205214852.GL1712166@ZenIV> (raw)
In-Reply-To: <gho6oczk2f.fsf@gouders.net>

On Fri, Dec 05, 2025 at 10:37:44PM +0100, Dirk Gouders wrote:

> 	child_pid1 = forkpty(&pty_fd1, NULL, NULL, NULL);

You do realize that it will inherit all your opened descriptors,
including pty_fd, right?

...

> 	close(pty_fd);

... which doesn't do anything to the second child's descriptor
table, including the descriptor that refers to the same opened file.
IOW, the IO channel (== opened file) is very much opened after
that close() - descriptors refering to it still exist.

  reply	other threads:[~2025-12-05 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 21:37 pty: childs don't always react on close(2) Dirk Gouders
2025-12-05 21:48 ` Al Viro [this message]
2025-12-05 22:20   ` Dirk Gouders

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=20251205214852.GL1712166@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=dirk@gouders.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-newbie@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.