summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-02-25 07:52:07 +0000
committerRoy Marples <roy@marples.name>2009-02-25 07:52:07 +0000
commite59105abf07540504b49d54ffbb547b907cc0e44 (patch)
tree59c74594114d01dc9e4cbde10652ead83dcd74b7 /dhcpcd.c
parentcd93080d6c02ea3cdb01cf72a4e660d515beb701 (diff)
downloaddhcpcd-e59105abf07540504b49d54ffbb547b907cc0e44.tar.xz
Don't timeout if we're daemonised.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 64372c6b..95d7b2ce 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1446,7 +1446,15 @@ main(int argc, char **argv)
add_event(linkfd, handle_link, NULL);
}
- if (options & DHCPCD_DAEMONISE && !(options & DHCPCD_BACKGROUND)) {
+ ifc = argc - optind;
+ ifv = argv + optind;
+ if (options & DHCPCD_BACKGROUND ||
+ (ifc == 0 &&
+ options & DHCPCD_LINK &&
+ options & DHCPCD_DAEMONISE))
+ {
+ daemonise();
+ } else if (options & DHCPCD_DAEMONISE) {
oi = ifo->timeout;
if (ifo->options & DHCPCD_IPV4LL)
oi += 10;
@@ -1454,11 +1462,6 @@ main(int argc, char **argv)
}
free_options(ifo);
- ifc = argc - optind;
- ifv = argv + optind;
- if (ifc == 0 && options & (DHCPCD_LINK | DHCPCD_DAEMONISE))
- daemonise();
-
ifaces = discover_interfaces(ifc, ifv);
for (i = 0; i < ifc; i++) {
for (iface = ifaces; iface; iface = iface->next)
@@ -1471,17 +1474,13 @@ main(int argc, char **argv)
if (!ifaces) {
if (ifc == 0)
syslog(LOG_ERR, "no valid interfaces found");
- if (!(options & DHCPCD_BACKGROUND) ||
- !(options & DHCPCD_LINK))
- {
+ if (!(options & DHCPCD_LINK)) {
syslog(LOG_ERR, "aborting as we're not backgrounding"
" with link detection");
exit(EXIT_FAILURE);
}
}
- if (options & DHCPCD_BACKGROUND)
- daemonise();
for (iface = ifaces; iface; iface = iface->next)
init_state(iface, argc, argv);
sort_interfaces();