script.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void run_script (struct dhcpMessage *packet, const char *name)


Function Documentation

void run_script ( struct dhcpMessage packet,
const char *  name 
)

Definition at line 202 of file script.c.

References client_config, DEBUG, LOG, LOG_ERR, LOG_INFO, and client_config_t::script.

Referenced by udhcp().

00203 {
00204         int pid;
00205         char **envp;
00206 
00207         if (client_config.script == NULL)
00208                 return;
00209 
00210         /* call script */
00211         pid = fork();
00212         if (pid) {
00213                 waitpid(pid, NULL, 0);
00214                 return;
00215         } else if (pid == 0) {
00216                 envp = fill_envp(packet);
00217                 
00218                 /* close fd's? */
00219                 
00220                 /* exec script */
00221                 DEBUG(LOG_INFO, "execle'ing %s", client_config.script);
00222                 execle(client_config.script, client_config.script,
00223                        name, NULL, envp);
00224                 LOG(LOG_ERR, "script %s failed: %s",
00225                     client_config.script, strerror(errno));
00226                 exit(1);
00227         }                       
00228 }


Generated on Tue Jan 15 12:24:47 2008 for Dynamics 0.8.1.Dynamo.1 by  doxygen 1.5.1