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>
Fri, 2 Jun 2017 13:34:06 +0000 (15:34 +0200)
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>

No differences found