From 812912126ee54592ddf966b26a6eff2826c10bf2 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Sun, 6 Apr 2014 02:27:52 -0400 Subject: [PATCH] ifch doesn't need to save a pidfile because its lifetime is strictly bounded by that of ndhc by the shared pipe, so remove that option. --- ndhc/ifchd.c | 7 ------- ndhc/ifchd.h | 1 - ndhc/ndhc.8 | 4 ---- ndhc/ndhc.c | 6 ------ 4 files changed, 18 deletions(-) diff --git a/ndhc/ifchd.c b/ndhc/ifchd.c index 2c945bc..cc7e88d 100644 --- a/ndhc/ifchd.c +++ b/ndhc/ifchd.c @@ -44,7 +44,6 @@ #include #include "nk/log.h" #include "nk/privilege.h" -#include "nk/pidfile.h" #include "nk/signals.h" #include "nk/io.h" @@ -67,7 +66,6 @@ static int resolv_conf_fd = -1; /* If true, allow HOSTNAME changes from dhcp server. */ int allow_hostname = 0; -char pidfile_ifch[PATH_MAX] = PID_FILE_IFCH_DEFAULT; uid_t ifch_uid = 0; gid_t ifch_gid = 0; @@ -382,11 +380,6 @@ static void do_ifch_work(void) void ifch_main(void) { prctl(PR_SET_NAME, "ndhc: ifch"); - if (file_exists(pidfile_ifch, "w") == -1) - suicide("FATAL - can't open ifch-pidfile '%s' for write!", - pidfile_ifch); - write_pid(pidfile_ifch); - memset(pidfile_ifch, '\0', sizeof pidfile_ifch); umask(077); setup_signals_ifch(); diff --git a/ndhc/ifchd.h b/ndhc/ifchd.h index 6aeb743..b6a545e 100644 --- a/ndhc/ifchd.h +++ b/ndhc/ifchd.h @@ -33,7 +33,6 @@ struct ifchd_client { extern struct ifchd_client cl; extern int allow_hostname; -extern char pidfile_ifch[PATH_MAX]; extern uid_t ifch_uid; extern gid_t ifch_gid; diff --git a/ndhc/ndhc.8 b/ndhc/ndhc.8 index 1b1ebdf..c46df88 100644 --- a/ndhc/ndhc.8 +++ b/ndhc/ndhc.8 @@ -39,10 +39,6 @@ Immediately fork into the background, even before obtaining a lease. Write the process id number of the ndhc process into the specified file name. The default is to not write the process id number into any file at all. .TP -.BI \-P\ PIDFILE ,\ \-\-ifch\-pidfile= PIDFILE -Write the process id number of the ndhc-ifch process into the specified file -name. The default is to not write the process id number into any file at all. -.TP .BI \-l\ LEASEFILE ,\ \-\-leasefile= LEASEFILE Write the IP address of the currently held DHCP lease into the specified file name. The default is to not write the lease IP address into any file at all. diff --git a/ndhc/ndhc.c b/ndhc/ndhc.c index 7e938b0..feb5fe8 100644 --- a/ndhc/ndhc.c +++ b/ndhc/ndhc.c @@ -106,7 +106,6 @@ static void show_usage(void) " -b, --background Fork to background if lease cannot be\n" " immediately negotiated.\n" " -p, --pidfile=FILE File where the ndhc pid will be written\n" -" -P, --ifch-pidfile=FILE File where the ndhc-ifch pid will be written\n" " -i, --interface=INTERFACE Interface to use (default: eth0)\n" " -n, --now Exit with failure if lease cannot be\n" " immediately negotiated.\n" @@ -458,7 +457,6 @@ static void parse_program_options(int argc, char *argv[]) {"clientid", required_argument, 0, 'c'}, {"background", no_argument, 0, 'b'}, {"pidfile", required_argument, 0, 'p'}, - {"ifch-pidfile", required_argument, 0, 'P'}, {"hostname", required_argument, 0, 'h'}, {"interface", required_argument, 0, 'i'}, {"now", no_argument, 0, 'n'}, @@ -501,10 +499,6 @@ static void parse_program_options(int argc, char *argv[]) case 'p': copy_cmdarg(pidfile, optarg, sizeof pidfile, "pidfile"); break; - case 'P': - copy_cmdarg(pidfile_ifch, optarg, sizeof pidfile_ifch, - "ifch-pidfile"); - break; case 'h': copy_cmdarg(client_config.hostname, optarg, sizeof client_config.hostname, "hostname");