make udhcp work under uclinux, to an extent

This commit is contained in:
Russ Dill 2003-12-15 22:11:26 +00:00
parent 4a9e34c148
commit 62419df95c
2 changed files with 7 additions and 1 deletions

View File

@ -102,6 +102,9 @@ static void exit_fun(void)
void background(const char *pidfile) void background(const char *pidfile)
{ {
#ifdef __uClinux__
LOG(LOG_ERR, "Cannot background in uclinux (yet)");
#else /* __uClinux__ */
int pid_fd = -1; int pid_fd = -1;
if (pidfile) { if (pidfile) {
@ -131,6 +134,7 @@ void background(const char *pidfile)
lockf(pid_fd, F_UNLCK, 0); lockf(pid_fd, F_UNLCK, 0);
close(pid_fd); close(pid_fd);
} }
#endif /* __uClinux__ */
} }
/* Signal handler */ /* Signal handler */

View File

@ -225,7 +225,7 @@ void run_script(struct dhcpMessage *packet, const char *name)
return; return;
/* call script */ /* call script */
pid = fork(); pid = vfork();
if (pid) { if (pid) {
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);
return; return;
@ -235,7 +235,9 @@ void run_script(struct dhcpMessage *packet, const char *name)
/* close fd's? */ /* close fd's? */
/* exec script */ /* exec script */
#ifndef __uClinux__
DEBUG(LOG_INFO, "execle'ing %s", client_config.script); DEBUG(LOG_INFO, "execle'ing %s", client_config.script);
#endif /* __uClinux__ */
execle(client_config.script, client_config.script, execle(client_config.script, client_config.script,
name, NULL, envp); name, NULL, envp);
LOG(LOG_ERR, "script %s failed: %m", client_config.script); LOG(LOG_ERR, "script %s failed: %m", client_config.script);