On Mon, 15 Feb 1999, Lourdes A Jones wrote:

> Mike Jagdis wrote:
> > That would explain a lot. Diald itself wants to be a session
> > leader so that it can run things like connect etc. in their
> > own process groups. This is necessary so that killing connect
> > scripts on time outs works. I made a mental note that it would
> > break if diald wasn't run as a daemon and forgot I'd never
> > figured out the necessary magic to make it work...
> 
> If this is the case you definitely need to change the man page and make a
> note in the readme file.

Oh, I thought a fix would be more appropriate :-)

  It's because if we don't fork we are a process group leader
(bash made us one because that is how job control works). If we
are a process group leader we can't become a session leader.
The fix is to change our process group to our parent's group
first if possible. If we are a process group leader our parent
must be a different process group. Our parent is either in the
same session, so we can join its process group, or we have
already been orphaned and can become a session leader at will.
If all that sounds complicated just add:

        setpgid(0, getppid());

immediately before the setsid() in diald.c:main() :-)

                                Mike

-- 
.----------------------------------------------------------------------.
| Mike Jagdis                   | Internet: [EMAIL PROTECTED]  |
| 280, Silverdale Road, Earley, | Voice:    +44 118 926 6996           |
| Reading RG6 7NU ENGLAND       | Work:     +44 118 989 0403           |
`----------------------------------------------------------------------'


-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]

Reply via email to