]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tools: Revisit stray file descriptor avoidance in onnode
authorMartin Schwenke <martin@meltin.net>
Tue, 27 Feb 2018 04:12:26 +0000 (15:12 +1100)
committerMartin Schwenke <martins@samba.org>
Thu, 1 Mar 2018 18:39:15 +0000 (19:39 +0100)
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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tools/onnode

index 890b60f0afc3c221426d254f44e5b12a80674d5b..e015a42c123305aa4d51980b5aff49327599f812 100755 (executable)
@@ -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=$?