[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251205214852.GL1712166@ZenIV>
Date: Fri, 5 Dec 2025 21:48:52 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Dirk Gouders <dirk@...ders.net>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>, linux-kernel@...r.kernel.org,
linux-newbie@...r.kernel.org
Subject: Re: pty: childs don't always react on close(2)
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.
Powered by blists - more mailing lists