From patchwork Thu Sep 10 08:32:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 516169 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 74D10140180 for ; Thu, 10 Sep 2015 18:33:19 +1000 (AEST) Received: from localhost ([::1]:47693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxID-000243-Bm for incoming@patchwork.ozlabs.org; Thu, 10 Sep 2015 04:33:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxHw-0001li-OJ for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:33:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZxHt-0006GJ-FI for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:33:00 -0400 Received: from smtpbg62.qq.com ([103.7.29.139]:24128 helo=smtpbg64.qq.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxHs-0006FS-Rt for qemu-devel@nongnu.org; Thu, 10 Sep 2015 04:32:57 -0400 X-QQ-mid: esmtp23t1441873966t234t27937 Received: from localhost.localdomain (unknown [36.110.17.42]) by esmtp4.qq.com (ESMTP) with id ; Thu, 10 Sep 2015 16:32:40 +0800 (CST) X-QQ-SSF: 01000000000000F0FG400500002000H X-QQ-FEAT: pJiIyMrDeHud5xtT4Vs5+iAcNsmaU8MqvLI0R6JyexzbBk0mgh8VZJltH/ffy EgRQr2BBQgX/GSiUhjAFnCNZvfd9SSXbHKq+5Qw3zCBNheeTCQ6JORXOepjxHY0Yqqg38n9 Z8tT20UJZGfNLE2gC9XKmLzpLhRdw3ml/ubf49vMywyssMvtnKJJsY1TVUOyWUyeEujHpPT TUSz+d4y7SwEo69eHGp31aFWDmGdvlivapm1FPuTvig== 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:32:39 +0800 Message-Id: <1441873959-4895-1-git-send-email-gang.chen.5i5j@gmail.com> X-Mailer: git-send-email 1.9.1 X-QQ-SENDSIZE: 520 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 103.7.29.139 Cc: peter.maydell@linaro.org, Chen Gang , qemu-devel@nongnu.org, xili_gchen_5257@hotmail.com, rth@twiddle.net Subject: [Qemu-devel] [PATCH v3] 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/main.c b/linux-user/main.c index 06dd296..dfbccbe 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,11 +3803,15 @@ static int parse_args(int argc, char **argv) if (optind >= argc) { usage(); } + buf = g_strdup_printf("%s=%s", arginfo->env, argv[optind]); arginfo->handle_opt(argv[optind]); optind++; } else { + buf = g_strdup_printf("%s=", arginfo->env); arginfo->handle_opt(NULL); } + (void) envlist_setenv(envlist, buf); + g_free(buf); break; } }