Project

General

Profile

« Previous | Next » 

Revision 9329ec08

Added by k-paulius about 10 years ago

Supress errors when opening custom DHCP config file and check if content was successfully retrieved. Prevents PHP from throwing error in case file does not exist.

View differences:

etc/inc/interfaces.inc
4236 4236

  
4237 4237
function DHCP_Config_File_Override($wancfg, $wanif) {
4238 4238

  
4239
	$dhclientconf = file_get_contents($wancfg['adv_dhcp_config_file_override_path']);
4240
	$dhclientconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf);
4239
	$dhclientconf = @file_get_contents($wancfg['adv_dhcp_config_file_override_path']);
4241 4240

  
4242
	return $dhclientconf;
4241
	if ($dhclientconf === false) {
4242
		log_error("Error: cannot open {$wancfg['adv_dhcp_config_file_override_path']} in DHCP_Config_File_Override() for reading.\n");
4243
		return '';
4244
	} else {
4245
		return DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf);
4246
	}
4243 4247
}
4244 4248

  
4245 4249

  

Also available in: Unified diff