From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZwwb-0001O1-5f for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:10:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZwwW-0005N0-3J for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:10:57 -0400 Received: from smtpbg299.qq.com ([184.105.67.99]:42544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZwwV-0005Li-Qx for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:10:52 -0400 Sender: gang.chen.5i5j@qq.com From: gang.chen.5i5j@gmail.com Date: Thu, 10 Sep 2015 16:10:22 +0800 Message-Id: <1441872622-4653-1-git-send-email-gang.chen.5i5j@gmail.com> Subject: [Qemu-devel] [PATCH v2] linux-user/main.c: Set environments variables from command line options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: riku.voipio@iki.fi Cc: peter.maydell@linaro.org, Chen Gang , qemu-devel@nongnu.org, xili_gchen_5257@hotmail.com, rth@twiddle.net From: Chen Gang When qemu execute execve() system call, the related command line options can not be passed to the second qemu process, which causes the second process fail. Signed-off-by: Chen Gang --- linux-user/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/main.c b/linux-user/main.c index 06dd296..f1f5496 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3767,6 +3767,7 @@ static void usage(void) static int parse_args(int argc, char **argv) { const char *r; + char *buf; int optind; const struct qemu_argument *arginfo; @@ -3802,6 +3803,9 @@ static int parse_args(int argc, char **argv) if (optind >= argc) { usage(); } + buf = g_strdup_printf("%s=%s", arginfo->env, argv[optind]); + (void) envlist_setenv(envlist, buf); + g_free(buf); arginfo->handle_opt(argv[optind]); optind++; } else { -- 1.9.1