[Libguestfs] [PATCH] p2v: require a non-interative sudo (RHBZ#1340809)

Pino Toscano ptoscano at redhat.com
Tue May 31 10:06:15 UTC 2016


Run sudo with -n (non-interactive), so it will fail right away when not
configured to not require a password.  This will avoid the connection to
time out.
---
 p2v/ssh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/p2v/ssh.c b/p2v/ssh.c
index b432cbd..c6bf306 100644
--- a/p2v/ssh.c
+++ b/p2v/ssh.c
@@ -490,7 +490,7 @@ test_connection (struct config *config)
    */
   if (mexp_printf (h,
                    "%svirt-v2v --version\n",
-                   config->sudo ? "sudo " : "") == -1) {
+                   config->sudo ? "sudo -n " : "") == -1) {
     set_ssh_error ("mexp_printf: %m");
     mexp_close (h);
     return -1;
-- 
2.5.5




More information about the Libguestfs mailing list