Home
last modified time | relevance | path

Searched hist:"1 e777bd8" (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/tools/testing/selftests/net/mptcp/
H A Dmptcp_join.sh1e777bd8 Wed Mar 09 13:16:34 CST 2022 Matthieu Baerts <matthieu.baerts@tessares.net> selftests: mptcp: join: clarify local/global vars

Some vars are redefined in different places. Best to avoid this
classical Bash pitfall where variables are accidentally overridden by
other functions because the proper scope has not been defined.

Most issues are with loops: typically 'i' is used in for-loops but if it
is not global, calling a function from a for-loop also doing a for-loop
with the same non local 'i' variable causes troubles because the first
'i' will be assigned to another value. To prevent such issues, the
iterator variable is now declared as local just before the loop. If it
is always done like this, issues are avoided.

To distinct between local and non local variables, all non local ones
are defined at the beginning of the script. The others are now defined
with the "local" keyword.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>