From 31d15af0fac26e36c9ff9d105e8a63a67b3d9578 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Fri, 12 Nov 2010 19:04:51 -0500 Subject: [PATCH] Don't fork off subprocesses to send to ifchd. Totally unnecessary. --- ndhc/script.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/ndhc/script.c b/ndhc/script.c index 1a08237..d372f0f 100644 --- a/ndhc/script.c +++ b/ndhc/script.c @@ -182,7 +182,6 @@ static void deconfig_if(void) sockwrite(sockfd, buf, strlen(buf)); close(sockfd); - exit(EXIT_SUCCESS); } static void translate_option(int sockfd, struct dhcpMessage *packet, int opt) @@ -240,36 +239,26 @@ static void bound_if(struct dhcpMessage *packet) translate_option(sockfd, packet, 17); close(sockfd); - exit(EXIT_SUCCESS); } void run_script(struct dhcpMessage *packet, int mode) { - int pid; - - pid = fork(); - if (pid) { - waitpid(pid, NULL, 0); - return; - } else if (pid == 0) { - switch (mode) { - case SCRIPT_DECONFIG: - deconfig_if(); - break; - case SCRIPT_BOUND: - bound_if(packet); - break; - case SCRIPT_RENEW: - bound_if(packet); - break; - case SCRIPT_NAK: - deconfig_if(); - break; - default: - break; - } - log_error("invalid script mode: %d", mode); - exit(EXIT_FAILURE); + switch (mode) { + case SCRIPT_DECONFIG: + deconfig_if(); + break; + case SCRIPT_BOUND: + bound_if(packet); + break; + case SCRIPT_RENEW: + bound_if(packet); + break; + case SCRIPT_NAK: + deconfig_if(); + break; + default: + log_error("invalid script mode: %d", mode); + break; } }