From 0b1a3b4c14992770ad4974d6d45fc11cefe1480a Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Fri, 12 Nov 2010 20:08:16 -0500 Subject: [PATCH] Create a pidfile even in the case where ndhc never backgrounds. --- ndhc/ndhc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ndhc/ndhc.c b/ndhc/ndhc.c index 7f4c424..db0386c 100644 --- a/ndhc/ndhc.c +++ b/ndhc/ndhc.c @@ -564,6 +564,14 @@ int main(int argc, char **argv) log_line("ndhc client " VERSION " started."); + if (client_config.foreground && !client_config.background_if_no_lease) { + if (file_exists(pidfile, "w") == -1) { + log_line("FATAL - cannot open pidfile for write!"); + exit(EXIT_FAILURE); + } + write_pid(pidfile); + } + if (read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.arp) < 0) exit(EXIT_FAILURE);