[CRIU] [PATCH] scripts: remove bogus command substitution in nfs-ports-allow.sh
Eugene Kolomeetz
klm at virtuozzo.com
Fri Jun 10 09:36:16 PDT 2016
When we want to just execute command (without capturing output), we must
not do it via $(cmd). With such form, shell first gets output of 'cmd',
and then evaluates it. If this is empty string, it is successfully
executed. If not empty, all breaks down.
https://jira.sw.ru/browse/PSBM-44207
Signed-off-by: Eugene Kolomeetz <klm at virtuozzo.com>
---
scripts/nfs-ports-allow.sh | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/scripts/nfs-ports-allow.sh b/scripts/nfs-ports-allow.sh
index f45eb9c..f8ab4a1 100644
--- a/scripts/nfs-ports-allow.sh
+++ b/scripts/nfs-ports-allow.sh
@@ -23,7 +23,7 @@ fi
JOIN_CT="${NS_ENTER} -t $CRTOOLS_INIT_PID -m -u -p -n"
-$(${JOIN_CT} test -e /proc/self/net/nfsfs) || exit 0
+${JOIN_CT} test -e /proc/self/net/nfsfs || exit 0
servers=$($JOIN_CT cat /proc/self/net/nfsfs/servers | sed -e '1d' | awk '{ printf $5" ";}')
@@ -33,10 +33,10 @@ function add_accept_rules {
local server=$1
local port=$2
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT ) &&
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT ) &&
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT ) &&
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT )
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT &&
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT &&
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT &&
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT
}
function iptables_allow_nfs_ports {
@@ -59,10 +59,10 @@ function allow_portmapper_port {
local server=$1
local port=111
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT ) &&
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT ) &&
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT ) &&
- $( ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT )
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT &&
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT &&
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT &&
+ ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT
}
for s in $servers; do
--
1.7.6
More information about the CRIU
mailing list