From: Martin Schwenke Date: Tue, 27 Feb 2018 04:12:26 +0000 (+1100) Subject: ctdb-tools: Revisit stray file descriptor avoidance in onnode X-Git-Tag: talloc-2.1.12~317 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=254a18422c567a591d7e99ff6d1d0678d985c5fa;p=thirdparty%2Fsamba.git ctdb-tools: Revisit stray file descriptor avoidance in onnode Commit 635da189dccef6516d490c228407b9987986c578 fixed a problem where a stray file descriptor leaked into a subshell. Explicitly close the file descriptor at the outermost possible point rather than relying on fakessh() to do it. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tools/onnode b/ctdb/tools/onnode index 890b60f0afc..e015a42c123 100755 --- a/ctdb/tools/onnode +++ b/ctdb/tools/onnode @@ -287,7 +287,7 @@ push() fakessh () { - CTDB_SOCKET="$1" sh -c "$2" 3>/dev/null + CTDB_SOCKET="$1" sh -c "$2" } stdout_filter () @@ -373,7 +373,7 @@ for n in $nodes ; do { exec 3>&1 { - $ssh_cmd "$n" "$command" | + $ssh_cmd "$n" "$command" 3>&- | stdout_filter >&3 } 2>&1 | stderr_filter } & @@ -386,7 +386,7 @@ for n in $nodes ; do { exec 3>&1 { - $ssh_cmd "$n" "$command" | + $ssh_cmd "$n" "$command" 3>&- | stdout_filter >&3 } 2>&1 | stderr_filter } || retcode=$?