From af1c84360f08f2ee32799ba266b0c384dde68173 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 26 Mar 2007 13:22:35 +0000 Subject: Move udhcp to new NOMMU helpers. Fix server part to compile under NOMMU. Client is not compilable yet. On MMU everything compiles (and maybe even works :) --- networking/udhcp/dhcpc.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'networking/udhcp/dhcpc.c') diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index a59c5db..dc10386 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -9,6 +9,7 @@ */ #include +#include #include "common.h" #include "dhcpd.h" @@ -103,7 +104,16 @@ static void perform_release(void) static void client_background(void) { - udhcp_background(client_config.pidfile); +#ifdef __uClinux__ + bb_error_msg("cannot background in uclinux (yet)"); +/* ... mainly because udhcpc calls client_background() + * in _the _middle _of _udhcpc _run_, not at the start! + * If that will be properly disabled for NOMMU, client_background() + * will work on NOMMU too */ +#else + bb_daemonize(DAEMON_CHDIR_ROOT); + logmode &= ~LOGMODE_STDIO; +#endif client_config.foreground = 1; /* Do not fork again. */ client_config.background_if_no_lease = 0; } @@ -246,13 +256,18 @@ int udhcpc_main(int argc, char *argv[]) return 0; } - /* Start the log, sanitize fd's, and write a pid file */ - udhcp_start_log_and_pid(client_config.pidfile); + if (ENABLE_FEATURE_UDHCP_SYSLOG) { + openlog(applet_name, LOG_PID, LOG_LOCAL0); + logmode |= LOGMODE_SYSLOG; + } if (read_interface(client_config.interface, &client_config.ifindex, NULL, client_config.arp) < 0) return 1; + /* Sanitize fd's and write pidfile */ + udhcp_make_pidfile(client_config.pidfile); + /* if not set, and not suppressed, setup the default client ID */ if (!client_config.clientid && !no_clientid) { client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, "", 7); -- cgit v1.1