Error handling in savesettings.php

This is to address https://github.com/pi-hole/pi-hole/issues/2444

Signed-off-by: Cynthia Revstrom <me@cynthia.re>
This commit is contained in:
Cynthia
2018-10-03 02:24:00 +02:00
committed by Cynthia Revstrom
parent af8c926cef
commit 34bbb9a70e

View File

@@ -63,7 +63,15 @@ function readStaticLeasesFile()
{
global $dhcp_static_leases;
$dhcp_static_leases = array();
$dhcpstatic = @fopen('/etc/dnsmasq.d/04-pihole-static-dhcp.conf', 'r');
try
{
$dhcpstatic = @fopen('/etc/dnsmasq.d/04-pihole-static-dhcp.conf', 'r');
}
catch(Exception $e)
{
echo "Warning: Failed to read /etc/dnsmasq.d/04-pihole-static-dhcp.conf, this is not an error";
return false;
}
if(!is_resource($dhcpstatic))
return false;