static char **ifv = NULL;
static int ifc = 0;
static int linkfd = -1;
-static char cffile[PATH_MAX];
+static char *cffile = NULL;
static char pidfile[PATH_MAX] = { '\0' };
static struct interface *ifaces = NULL;
ifs->nakoff = 1;
configure_interface(iface, argc, argv);
- if (!(ifs->options->options & DHCPCD_TEST))
+ if (!(options & DHCPCD_TEST))
run_script(iface, "PREINIT");
if (ifs->options->options & DHCPCD_LINK) {
/* Saves calling fflush(stream) in the logger */
setlinebuf(stdout);
openlog(PACKAGE, LOG_PID, LOG_LOCAL0);
- strlcpy(cffile, CONFIG, sizeof(cffile));
options = DHCPCD_DAEMONISE;
/* Test for --help and --version */
setloglevel(LOG_DEBUG);
break;
case 'f':
- strlcpy(cffile, optarg, sizeof(cffile));
+ cffile = optarg;
break;
case 'k':
sig = SIGHUP;
}
#ifdef THERE_IS_NO_FORK
- ifo->options &= ~DHCPCD_DAEMONISE;
+ options &= ~DHCPCD_DAEMONISE;
#endif
chdir("/");
logger(LOG_ERR, "failed to send commands");
exit(EXIT_FAILURE);
}
+ } else {
+ if (errno != EEXIST)
+ logger(LOG_ERR, "open_control: %m");
}
}
#include <unistd.h>
#include <time.h>
-#include "common.h"
#include "config.h"
+#include "common.h"
#include "dhcpf.h"
#include "if-options.h"
#include "logger.h"
"%s %s", PACKAGE, VERSION);
/* Parse our options file */
- f = fopen(file, "r");
+ f = fopen(file ? file : CONFIG, "r");
if (!f)
return ifo;