Handle cases where glob() returns false

Fixes #203
This commit is contained in:
Ben Ramsey
2018-01-16 14:05:53 -06:00
parent fc6ebc6e72
commit 901c3e540d
2 changed files with 54 additions and 16 deletions
+7 -2
View File
@@ -88,10 +88,15 @@ class SystemNodeProvider implements NodeProviderInterface
{
$mac = false;
if (strtoupper(php_uname('s')) === "LINUX") {
// get all the macadresses of all systems
$addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT);
if (empty($addressPaths)) {
return false;
}
$macs = array_map(
'file_get_contents',
glob('/sys/class/net/*/address', GLOB_NOSORT)
$addressPaths
);
$macs = array_map('trim', $macs);