This makes the generated script a bit shorter and removes an unnecessary call to test. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/rpc/virnetclient.c | 3 +-- tests/virnetsockettest.c | 3 +-- 2 files changed, 2 insertions(+), 4 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; " diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c index 1bd5255d90..adff6a0f9e 100644 --- a/tests/virnetsockettest.c +++ b/tests/virnetsockettest.c @@ -717,8 +717,7 @@ mymain(void) .nodename = "somehost", .path = "/tmp/socket", .expectOut = "-T -e none -- somehost sh -c '" - "which virt-ssh-helper 1>/dev/null 2>&1; " - "if test $? = 0; then " + "if which virt-ssh-helper >/dev/null 2>&1; then " "virt-ssh-helper -r 'qemu:///session'; " "else " "if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " -- 2.35.1