]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(network): check if ip command fails
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Fri, 2 Dec 2022 22:30:55 +0000 (22:30 +0000)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Sat, 17 Dec 2022 12:29:54 +0000 (07:29 -0500)
modules.d/40network/net-lib.sh

index 1c8f312687a4c51915a446b7ff6779c365caca84..4797dd6cb6371dbb99c7b74e41a008669f93a2dc 100755 (executable)
@@ -101,7 +101,10 @@ get_netroot_ip() {
 }
 
 ip_is_local() {
-    strstr "$(ip route get "$@" 2> /dev/null)" " via " || return 0
+    li=$(ip route get "$@" 2> /dev/null)
+    if [ -n "$li" ]; then
+        strstr "$li" " via " || return 0
+    fi
     return 1
 }