make udhcp work under uclinux, to an extent
authorRuss Dill <Russ.Dill@asu.edu>
Mon, 15 Dec 2003 22:11:26 +0000 (22:11 -0000)
committerRuss Dill <Russ.Dill@asu.edu>
Mon, 15 Dec 2003 22:11:26 +0000 (22:11 -0000)
networking/udhcp/common.c
networking/udhcp/script.c

index ab4fa305add9db26eade26cdf09a975183c36e14..babd980e334f341dffda72f563a38e5d11d400c1 100644 (file)
@@ -102,6 +102,9 @@ static void exit_fun(void)
 
 void background(const char *pidfile)
 {
+#ifdef __uClinux__
+       LOG(LOG_ERR, "Cannot background in uclinux (yet)");     
+#else /* __uClinux__ */
        int pid_fd = -1;
 
        if (pidfile) {
@@ -131,6 +134,7 @@ void background(const char *pidfile)
                lockf(pid_fd, F_UNLCK, 0);
                close(pid_fd);
        }
+#endif /* __uClinux__ */
 }
 
 /* Signal handler */
index 7876dd3c7e13deccf407ceecc52b783c5069578e..0f2a21c3acba9ae2d74de7afdc9999603b1dda97 100644 (file)
@@ -225,7 +225,7 @@ void run_script(struct dhcpMessage *packet, const char *name)
                return;
 
        /* call script */
-       pid = fork();
+       pid = vfork();
        if (pid) {
                waitpid(pid, NULL, 0);
                return;
@@ -235,7 +235,9 @@ void run_script(struct dhcpMessage *packet, const char *name)
                /* close fd's? */
                
                /* exec script */
+#ifndef __uClinux__
                DEBUG(LOG_INFO, "execle'ing %s", client_config.script);
+#endif /* __uClinux__ */
                execle(client_config.script, client_config.script,
                       name, NULL, envp);
                LOG(LOG_ERR, "script %s failed: %m", client_config.script);