Lines 112-118
Link Here
|
112 |
if ( fork() == 0 ) |
112 |
if ( fork() == 0 ) |
113 |
#endif |
113 |
#endif |
114 |
{ |
114 |
{ |
115 |
char *argc[3],exec_on_change[128]; |
115 |
char *argc[4],exec_on_change[128]; |
116 |
|
116 |
|
117 |
if ( Cfilename ) |
117 |
if ( Cfilename ) |
118 |
snprintf(exec_on_change,sizeof(exec_on_change),Cfilename); |
118 |
snprintf(exec_on_change,sizeof(exec_on_change),Cfilename); |
Lines 122-130
Link Here
|
122 |
argc[1]=hostinfo_file; |
122 |
argc[1]=hostinfo_file; |
123 |
argc[2]=prm; |
123 |
argc[2]=prm; |
124 |
argc[3]=NULL; |
124 |
argc[3]=NULL; |
125 |
if ( execve(exec_on_change,argc,ProgramEnviron) && errno != ENOENT ) |
125 |
logger(LOG_DEBUG, "about to exec \"%s %s %s\"", exec_on_change, |
126 |
logger(LOG_ERR,"error executing \"%s %s %s\": %s", |
126 |
hostinfo_file, prm); |
127 |
exec_on_change,hostinfo_file,prm,strerror(errno)); |
127 |
if ( execve(exec_on_change,argc,ProgramEnviron) && |
|
|
128 |
( errno != ENOENT || Cfilename ) ) |
129 |
logger(LOG_ERR, "error executing \"%s %s %s\": %s", |
130 |
exec_on_change,hostinfo_file, prm, strerror(errno)); |
128 |
exit(0); |
131 |
exit(0); |
129 |
} |
132 |
} |
130 |
} |
133 |
} |
Lines 785-803
Link Here
|
785 |
} |
788 |
} |
786 |
else |
789 |
else |
787 |
logger(LOG_ERR,"dhcpConfig: fopen %s: %s", hostinfo_file, strerror(errno)); |
790 |
logger(LOG_ERR,"dhcpConfig: fopen %s: %s", hostinfo_file, strerror(errno)); |
788 |
#if 0 |
791 |
|
789 |
if ( Cfilename ) |
|
|
790 |
if ( fork() == 0 ) |
791 |
{ |
792 |
char *argc[2]; |
793 |
argc[0]=Cfilename; |
794 |
argc[1]=NULL; |
795 |
if ( execve(Cfilename,argc,ProgramEnviron) ) |
796 |
logger(LOG_ERR,"error executing \"%s\": %s", |
797 |
Cfilename,strerror(errno)); |
798 |
exit(0); |
799 |
} |
800 |
#endif |
801 |
if ( DhcpIface.ciaddr == prev_ip_addr ) |
792 |
if ( DhcpIface.ciaddr == prev_ip_addr ) |
802 |
execute_on_change("up"); |
793 |
execute_on_change("up"); |
803 |
else /* IP address has changed */ |
794 |
else /* IP address has changed */ |
Lines 805-815
Link Here
|
805 |
execute_on_change("new"); |
796 |
execute_on_change("new"); |
806 |
prev_ip_addr=DhcpIface.ciaddr; |
797 |
prev_ip_addr=DhcpIface.ciaddr; |
807 |
} |
798 |
} |
808 |
/* if ( *(unsigned int *)DhcpOptions.val[dhcpIPaddrLeaseTime] == 0xffffffff ) |
799 |
|
809 |
{ |
|
|
810 |
logger(LOG_INFO,"infinite IP address lease time. Exiting"); |
811 |
exit(0); |
812 |
} */ |
813 |
return 0; |
800 |
return 0; |
814 |
} |
801 |
} |
815 |
/*****************************************************************************/ |
802 |
/*****************************************************************************/ |