[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#45104: setsid() breakage



Roland McGrath <roland@gnu.org> writes:

> > One bug, probably not connected: If a program with no controlling
> > terminal execs, but which has a terminal open, then the new image will
> > acquire a controlling terminal.  This is wrong.  The call to
> > _hurd_port2fd inside dtable.c:init_dtable should set the O_IGNORE_CTTY
> > flag to prevent the aquisition of a controlling terminal as a side
> > effect of exec.
> 
> You are clearly confused about how those functions work.  _hurd_port2fd has
> nothing to do with choosing the controlling terminal; it simply checks
> (unless given O_IGNORE_CTTY) if the port is in fact to the controlling
> terminal device already associated with process.  The `ctty' io ports do
> not control what is the ctty, the process's CTTYID port controls that.

Ah, right, that's correct.  Sorry for my confusion.

Though once the ctty port gets set, cttyid is not checked again for
that file descriptor in normal operation.  

> > Second bug (documentation): In <hurd/fd.h> the documentation for
> > hurd_fd.ctty gets port and ctty backwards.  `port' is always a vanilla
> > port; `ctty' is sometimes a magical port.
> 
> Yes, I was briefly confused about that myself; that's no doubt because it
> used to be reversed in a previous incarnation of the implementation.

Ok, can you check in a doc fix?

Thomas


Reply to: