• Matthieu Baerts's avatar
    selftests: mptcp: join: clarify local/global vars · 1e777bd8
    Matthieu Baerts authored
    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: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
    Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    1e777bd8
mptcp_join.sh 63.8 KB