Re: pty: childs don't always react on close(2)
Al Viro <[email protected]> Fri, 5 Dec 2025 21:48:52 +0000
| Newsgroups | gmane.linux.newbie,gmane.linux.kernel |
|---|---|
| Message-ID | <20251205214852.GL1712166@ZenIV> |
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.