summaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-03-26 13:22:35 +0000
committerDenis Vlasenko2007-03-26 13:22:35 +0000
commitaf1c84360f08f2ee32799ba266b0c384dde68173 (patch)
tree4272fbe921bc693c52197ac5d227fcbc42b3c154 /networking/udhcp/dhcpc.c
parent5a142025d372ae5dff7d7cf98f442edaafd1dc30 (diff)
downloadbusybox-af1c84360f08f2ee32799ba266b0c384dde68173.zip
busybox-af1c84360f08f2ee32799ba266b0c384dde68173.tar.gz
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 :)
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r--networking/udhcp/dhcpc.c21
1 files changed, 18 insertions, 3 deletions
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 <getopt.h>
+#include <syslog.h>
#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);