[libvirt PATCH 07/11] virnetclient: Use 'if' consistently

Andrea Bolognani abologna at redhat.com
Fri Feb 11 17:39:15 UTC 2022


This makes the generated script a bit shorter and removes an
unnecessary call to test.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/rpc/virnetclient.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index cbefa8f11f..7e7e9d52a6 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -449,8 +449,7 @@ virNetClientSSHHelperCommand(virNetClientProxy proxy,
 
     switch (proxy) {
     case VIR_NET_CLIENT_PROXY_AUTO:
-        return g_strdup_printf("sh -c 'which virt-ssh-helper 1>/dev/null 2>&1; "
-                               "if test $? = 0; then "
+        return g_strdup_printf("sh -c 'if which virt-ssh-helper >/dev/null 2>&1; then "
                                    "%s; "
                                "else "
                                    "%s; "
-- 
2.34.1




More information about the libvir-list mailing list