From c9e04ae0f7969400f74c72cb5760a1ca8f75eb65 Mon Sep 17 00:00:00 2001 From: Per von Zweigbergk Date: Sat, 13 Aug 2016 16:42:24 +0000 Subject: [PATCH] (get_interface_list) Properly handle an interface not appearing in dmesg --- src/etc/inc/util.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 7daee917b..26a8ee0dd 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -948,12 +948,13 @@ function get_interface_list($only_active = false) } $dmesg_arr = array(); + $toput['dmesg'] = null; exec("/sbin/dmesg |grep $ifname", $dmesg_arr); - preg_match_all("/<(.*?)>/i", $dmesg_arr[0], $dmesg); - if (isset($dmesg[1][0])) { - $toput['dmesg'] = $dmesg[1][0]; - } else { - $toput['dmesg'] = null; + if (count($dmesg_arr) > 0) { + preg_match_all("/<(.*?)>/i", $dmesg_arr[0], $dmesg); + if (isset($dmesg[1][0])) { + $toput['dmesg'] = $dmesg[1][0]; + } } $iflist[$ifname] = $toput;