mirror of
https://github.com/pi-hole/web.git
synced 2025-12-27 13:59:14 +00:00
Merge pull request #1206 from pi-hole/fix/dhcp_static_error
Check for existence and readability of static leases file before trying to access it
This commit is contained in:
@@ -79,16 +79,10 @@ function readStaticLeasesFile($origin_file="/etc/dnsmasq.d/04-pihole-static-dhcp
|
||||
{
|
||||
global $dhcp_static_leases;
|
||||
$dhcp_static_leases = array();
|
||||
try
|
||||
{
|
||||
$dhcpstatic = @fopen($origin_file, 'r');
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
echo "Warning: Failed to read ".$origin_file.", this is not an error";
|
||||
if(!file_exists($origin_file) || !is_readable($origin_file))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$dhcpstatic = @fopen($origin_file, 'r');
|
||||
if(!is_resource($dhcpstatic))
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user