Move the daemon() call in the parent process from after forking the
authorbenno <benno@openbsd.org>
Sat, 3 Sep 2022 20:07:31 +0000 (20:07 +0000)
committerbenno <benno@openbsd.org>
Sat, 3 Sep 2022 20:07:31 +0000 (20:07 +0000)
commit7a99b37dfd03f1f281b20ab09f836d05794a9da5
tree91e7bc520b043a53141ed516089dfeacddcd919d
parent8ee7443b1ffb397cbdf743817f4462aff533568f
Move the daemon() call in the parent process from after forking the
children to just before.  That way the parent disasociates from its
controling terminal and shell, but not from its children.

Remove the dup2() bits that were copied from daemon() to solve the
problem that the children still had the stdio fds open. This is now
done in the parent earlier.

Remove the setsid() and setpgid(). It is unclear what their intent
was, but they dont seem to make sense, as daemon() covers this as well
and there seems to be no reason the cildren procs need to do that.

ok claudio@ bluhm@
usr.sbin/relayd/proc.c
usr.sbin/relayd/relayd.c