[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: give_terminal_to() / maybe_give_terminal_to() race
From: |
Martin D Kealey |
Subject: |
Re: give_terminal_to() / maybe_give_terminal_to() race |
Date: |
Fri, 1 Sep 2023 21:58:16 +1000 |
On Fri, 1 Sep 2023, 15:51 Earl Chew, <earl_chew@yahoo.com> wrote:
> The controlling terminal must be reconfigured before the parent gets to
> wait() for the job,
and before the child gets to exec() the program (or their equivalents).
This second point makes sense, but I don't really see why the first point
is necessary. As long as the terminal has changed ownership when waitpid()
returns, why does it matter *when* exactly? What else – if anything – needs
doing after changing the tty pgrp and before calling waitpid()?
I would have though the obvious fix was to move setting tty pgrp into the
child; this would guarantee that it happens before the execve() and before
the waitpid() returns.
-Martin
Re: give_terminal_to() / maybe_give_terminal_to() race, Chet Ramey, 2023/09/01