[LTP] [PATCH 7/9] tst_net.sh: Remove unused variable ret

Petr Vorel
2023-01-26T21:55:43Z

$? is enough in tst_net_detect_ipv6_cmdline().

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/lib/tst_net.sh | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 3a9c16f070..518a3ed579 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -100,23 +100,20 @@ tst_brk_()
[ -z "$TST_USE_LEGACY_API" ] && tst_brk $@ || tst_brkm $@
}

-# detect IPv6 not disabled via ipv6.disable=1 kernel cmdline parameter
-# or via CONFIG_IPV6=y kernel configure option
-# $TST_NET_IPV6_ENABLED: 1 (enabled), 0 (disabled)
+# Detect IPv6 disabled via ipv6.disable=1 kernel cmdline parameter
+# or via CONFIG_IPV6=y kernel configure option.
tst_net_detect_ipv6_cmdline()
{
local type="${1:-lhost}"
local cmd='[ -f /proc/net/if_inet6 ]'
- local ret

if [ "$type" = "lhost" ]; then
$cmd
else
tst_rhost_run -c "$cmd"
fi
- ret=$?

- if [ $ret -eq 0 ]; then
+ if [ $? -eq 0 ]; then
TST_NET_IPV6_ENABLED=1
else
TST_NET_IPV6_ENABLED=0