qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: gang.chen.5i5j@gmail.com
To: riku.voipio@iki.fi
Cc: peter.maydell@linaro.org, Chen Gang <gang.chen.5i5j@gmail.com>,
	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
Date: Thu, 10 Sep 2015 16:10:22 +0800	[thread overview]
Message-ID: <1441872622-4653-1-git-send-email-gang.chen.5i5j@gmail.com> (raw)

From: Chen Gang <gang.chen.5i5j@gmail.com>

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 <gang.chen.5i5j@gmail.com>
---
 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

             reply	other threads:[~2015-09-10  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10  8:10 gang.chen.5i5j [this message]
2015-09-10  8:28 ` [Qemu-devel] [PATCH v2] linux-user/main.c: Set environments variables from command line options Chen Gang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441872622-4653-1-git-send-email-gang.chen.5i5j@gmail.com \
    --to=gang.chen.5i5j@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    --cc=xili_gchen_5257@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).