From patchwork Thu Sep 10 08:10:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 516162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 33A3D1400CB for ; Thu, 10 Sep 2015 18:11:15 +1000 (AEST) Received: from localhost ([::1]:47636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZwwq-0001fi-MV for incoming@patchwork.ozlabs.org; Thu, 10 Sep 2015 04:11:12 -0400 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 X-QQ-mid: esmtp28t1441872636t398t25909 Received: from localhost.localdomain (unknown [36.110.17.42]) by esmtp4.qq.com (ESMTP) with id ; Thu, 10 Sep 2015 16:10:25 +0800 (CST) X-QQ-SSF: 01000000000000F0FG400500002000H X-QQ-GoodBg: 0 X-QQ-CSender: gang.chen.5i5j@qq.com From: gang.chen.5i5j@gmail.com To: riku.voipio@iki.fi Date: Thu, 10 Sep 2015 16:10:22 +0800 Message-Id: <1441872622-4653-1-git-send-email-gang.chen.5i5j@gmail.com> X-Mailer: git-send-email 1.9.1 X-QQ-SENDSIZE: 520 X-QQ-FName: C949DB1837BF42ED9B1A9803E1F20EA0 X-QQ-LocalIP: 163.177.66.155 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 184.105.67.99 Cc: peter.maydell@linaro.org, Chen Gang , qemu-devel@nongnu.org, xili_gchen_5257@hotmail.com, rth@twiddle.net Subject: [Qemu-devel] [PATCH v2] linux-user/main.c: Set environments variables from command line options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 {