464xlat: rework process id write logic
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 1 Jun 2017 12:19:42 +0000 (14:19 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 26 Jun 2017 07:36:05 +0000 (09:36 +0200)
commit3d18d0cfc2e3023be075eb3a5f519da6571073b0
tree731fd7b7459472d79013ab6371e8236299a9bdff
parentae774f4a9733b78052b60bee1d28025806c4d870
464xlat: rework process id write logic

Write the process id in the pid file immediately after the 464xlat pid file has
been openend. Before the process id was written when the parent process exits
leaving a window where no valid process id was in place in the 464xlat pid file.
This lead to issues if the 464xlat utility was launched to terminate a running
464xlat utility as it could possibly terminate a random process.
If the parent process exits the pid file is updated with the process id of the
forked 464xlat utility.
Also rework the signal handling of SIGTERM so the running 464xlat utility is
correctly terminated.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
nat46/src/464xlatcfg.c