OSDN Git Service

qga: fix for default env processing for guest-exec
authorYuri Pudgorodskiy <yur@virtuozzo.com>
Thu, 12 Nov 2015 13:36:20 +0000 (16:36 +0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 17 Nov 2015 22:24:18 +0000 (16:24 -0600)
envp == NULL must be passed inside gspawn() if it was not passed with
the command line. Original code inherits environment from the QGA,
which is wrong.

Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/commands.c

index 0f80ce6..7644ca0 100644 (file)
@@ -398,7 +398,7 @@ GuestExec *qmp_guest_exec(const char *path,
     arglist.next = has_arg ? arg : NULL;
 
     argv = guest_exec_get_args(&arglist, true);
-    envp = guest_exec_get_args(has_env ? env : NULL, false);
+    envp = has_env ? guest_exec_get_args(env, false) : NULL;
 
     flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD;
     if (!has_output) {