Refactor, simplify registration of built-in watchdog daemon

This patch not only greatly simplifies the registration of the built-in
watchdog daemon, it also fixes a nasty race condition with an external
watchdog daemon.  The INIT_CMD_WDOG_HELLO could reach finit in reversed
order, leading to the built-in daemon shutting down, but finit killing
the just registered external daemon.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-11-19 16:48:32 +01:00
1 parent e0fb2b036d
commit 3c800f6508
3 files changed
+14 -49

No files matched your search

+1 -1
View File
@@ -390,7 +390,7 @@ int main(int argc, char* argv[])
/*
* Start built-in watchdog as soon as possible, if enabled
*/
watchdog(argv[0]);
wdogpid = watchdog(argv[0]);
/* Set hostname as soon as possible, for syslog et al. */
set_hostname(&hostname);