The name of variable $ok gives no clue to its meaning/use so this
changes that variable to be named $up_interfaces_found.
The return logic relating to $ok and $fail is difficult to read, so
these variables are given true/fale values, allowing the return logic
to be simplified.
Signed-off-by: Martin Schwenke <martin@meltin.net>
mark_up ()
{
- ok=1
+ up_interfaces_found=true
ctdb setifacelink $1 up >/dev/null 2>&1
}
mark_down ()
{
- fail=1
+ fail=true
ctdb setifacelink $1 down >/dev/null 2>&1
}
INTERFACES=`for IFACE in $INTERFACES $IFACES ; do echo $IFACE ; done | sort | uniq`
- fail=0
- ok=0
+ fail=false
+ up_interfaces_found=false
for IFACE in $INTERFACES ; do
ip addr show $IFACE 2>/dev/null >/dev/null || {
done
- test x"$fail" = x"0" && {
- return 0;
- }
+ $fail || return 0
- test x"$ok" = x"1" && {
- return 2;
- }
+ $up_interfaces_found && return 2
- return 1;
+ return 1
}
case "$1" in