Explorar o código

Handle default value for get_iface_from_mac

Frédéric Pierret (fepitre) %!s(int64=5) %!d(string=hai) anos
pai
achega
902da9f837
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      init/functions

+ 3 - 1
init/functions

@@ -131,7 +131,9 @@ umount_retry() {
 get_iface_from_mac() {
     local mac="$1"
     local iface
-    iface="$(ip -o link | grep -i "$mac" | awk '{print $2}' | cut -d ':' -f1)"
+    if [ "x$mac" != "x" ]; then
+        iface="$(ip -o link | grep -i "$mac" | awk '{print $2}' | cut -d ':' -f1)"
+    fi
     echo "$iface"
 }