From: Peter Maydell <peter.maydell@linaro.org>
To: Anthony Liguori <aliguori@amazon.com>
Cc: "Blue Swirl" <blauwirbel@gmail.com>,
"Andreas Färber" <andreas.faerber@web.de>,
qemu-devel@nongnu.org, "Aurelien Jarno" <aurelien@aurel32.net>
Subject: [Qemu-devel] [PULL 5/9] ui/cocoa: Fix code for starting QEMU via image file load dialog
Date: Sun, 12 Jan 2014 22:52:34 +0000 [thread overview]
Message-ID: <1389567158-31066-6-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1389567158-31066-1-git-send-email-peter.maydell@linaro.org>
Fix a number of bugs in the code for starting QEMU via the image
file load dialog:
* use the actual argv[0] rather than "qemu": this avoids failures to
find BIOS image files caused by not looking in the correct directory
relative to the executable path
* allocate a large enough argv array to NULL terminate it
* use g_strdup(X) rather than g_strdup_printf("%s", X) or
g_strdup_printf(X)
* disable the printing of the simulated command line argument
(which is presumably intended for debug only)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-6-git-send-email-peter.maydell@linaro.org
---
ui/cocoa.m | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index fd55044..b90b782 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -833,18 +833,18 @@ QemuCocoaView *cocoaView;
if(returnCode == NSCancelButton) {
exit(0);
} else if(returnCode == NSOKButton) {
- const char *bin = "qemu";
char *img = (char*)[ [ [ sheet URL ] path ] cStringUsingEncoding:NSASCIIStringEncoding];
- char **argv = (char**)malloc( sizeof(char*)*3 );
+ char **argv = g_new(char *, 4);
[sheet close];
- argv[0] = g_strdup_printf("%s", bin);
- argv[1] = g_strdup_printf("-hda");
- argv[2] = g_strdup_printf("%s", img);
+ argv[0] = g_strdup(gArgv[0]);
+ argv[1] = g_strdup("-hda");
+ argv[2] = g_strdup(img);
+ argv[3] = NULL;
- printf("Using argc %d argv %s -hda %s\n", 3, bin, img);
+ // printf("Using argc %d argv %s -hda %s\n", 3, gArgv[0], img);
[self startEmulationWithArgc:3 argv:(char**)argv];
}
--
1.8.5
next prev parent reply other threads:[~2014-01-12 22:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-12 22:52 [Qemu-devel] [PULL 0/9] cocoa queue Peter Maydell
2014-01-12 22:52 ` [Qemu-devel] [PULL 1/9] ui/cocoa: Pass command key through to guest when VM has mousegrab Peter Maydell
2014-01-12 22:52 ` [Qemu-devel] [PULL 2/9] ui/cocoa: Correct typos in comments and variable names Peter Maydell
2014-01-12 22:52 ` [Qemu-devel] [PULL 3/9] ui/cocoa: Send warning message to stderr, not stdout Peter Maydell
2014-01-12 22:52 ` [Qemu-devel] [PULL 4/9] ui/cocoa: Add ".qcow2" to extension list for image load dialog Peter Maydell
2014-01-12 22:52 ` Peter Maydell [this message]
2014-01-12 22:52 ` [Qemu-devel] [PULL 6/9] ui/cocoa: Redraw at correct size when switching surface Peter Maydell
2014-01-12 22:52 ` [Qemu-devel] [PULL 7/9] ui/cocoa: Draw black rectangle if we have no data yet Peter Maydell
2014-01-12 22:52 ` [Qemu-devel] [PULL 8/9] ui/cocoa: Remove stray tabs Peter Maydell
2014-01-12 22:52 ` [Qemu-devel] [PULL 9/9] MAINTAINERS: add myself as cocoa UI co-maintainer Peter Maydell
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=1389567158-31066-6-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=aliguori@amazon.com \
--cc=andreas.faerber@web.de \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/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).