On Fri, 1 Sep 2023, 15:51 Earl Chew, <earl_c...@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

Reply via email to