diff options
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r-- | networking/udhcp/dhcpc.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index a59c5db74..dc10386d5 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <getopt.h> | 11 | #include <getopt.h> |
12 | #include <syslog.h> | ||
12 | 13 | ||
13 | #include "common.h" | 14 | #include "common.h" |
14 | #include "dhcpd.h" | 15 | #include "dhcpd.h" |
@@ -103,7 +104,16 @@ static void perform_release(void) | |||
103 | 104 | ||
104 | static void client_background(void) | 105 | static void client_background(void) |
105 | { | 106 | { |
106 | udhcp_background(client_config.pidfile); | 107 | #ifdef __uClinux__ |
108 | bb_error_msg("cannot background in uclinux (yet)"); | ||
109 | /* ... mainly because udhcpc calls client_background() | ||
110 | * in _the _middle _of _udhcpc _run_, not at the start! | ||
111 | * If that will be properly disabled for NOMMU, client_background() | ||
112 | * will work on NOMMU too */ | ||
113 | #else | ||
114 | bb_daemonize(DAEMON_CHDIR_ROOT); | ||
115 | logmode &= ~LOGMODE_STDIO; | ||
116 | #endif | ||
107 | client_config.foreground = 1; /* Do not fork again. */ | 117 | client_config.foreground = 1; /* Do not fork again. */ |
108 | client_config.background_if_no_lease = 0; | 118 | client_config.background_if_no_lease = 0; |
109 | } | 119 | } |
@@ -246,13 +256,18 @@ int udhcpc_main(int argc, char *argv[]) | |||
246 | return 0; | 256 | return 0; |
247 | } | 257 | } |
248 | 258 | ||
249 | /* Start the log, sanitize fd's, and write a pid file */ | 259 | if (ENABLE_FEATURE_UDHCP_SYSLOG) { |
250 | udhcp_start_log_and_pid(client_config.pidfile); | 260 | openlog(applet_name, LOG_PID, LOG_LOCAL0); |
261 | logmode |= LOGMODE_SYSLOG; | ||
262 | } | ||
251 | 263 | ||
252 | if (read_interface(client_config.interface, &client_config.ifindex, | 264 | if (read_interface(client_config.interface, &client_config.ifindex, |
253 | NULL, client_config.arp) < 0) | 265 | NULL, client_config.arp) < 0) |
254 | return 1; | 266 | return 1; |
255 | 267 | ||
268 | /* Sanitize fd's and write pidfile */ | ||
269 | udhcp_make_pidfile(client_config.pidfile); | ||
270 | |||
256 | /* if not set, and not suppressed, setup the default client ID */ | 271 | /* if not set, and not suppressed, setup the default client ID */ |
257 | if (!client_config.clientid && !no_clientid) { | 272 | if (!client_config.clientid && !no_clientid) { |
258 | client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, "", 7); | 273 | client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, "", 7); |