From patchwork Sun Dec 8 22:59:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22146 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E38923FDD for ; Sun, 8 Dec 2013 22:59:12 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf11941819oag.5 for ; Sun, 08 Dec 2013 14:59:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=wVW0vzAizQgpabNS00NLDUCAcXGplm7ep2DgTeOeq4w=; b=a4Y9LSe4/igmLvsXquUFH1HXJZV7l8lpQIpAFCSqa7QL+/ySdO5wqqs0hPxr5AiS0P GAa41I4xVdXWyO20vhvCJf9DKXxm+FFnOh+jJVWCQ/pywW4thAWtz+RZALMFPtkgkniF Hd1QUVX5f1FBEbk2hk3DaLLoeBmhPBzbKIce8aJIYosDcA10fZWPw8UffVkbsDOCatq1 wthZcuYjp9gKPUb4MuWHWc2QIjaZs25NgJSejM0PV2fRe/WxE93YN2MZsvkUD5i0ZPl6 t8IMPXl3a5XWPLScyuvfBi9qmsacL5Q+uCCaDwPI5pxjLWFmIKjnHb8Vs6P9IhACYZLs OXPA== X-Gm-Message-State: ALoCoQlYNeLoQr7Gzs0hUJODP80fHELwS8R8YmjI2QEdujtLortG97zX1mpYKSgvfAZNnnkl7Xcw X-Received: by 10.182.9.36 with SMTP id w4mr5421319oba.37.1386543551653; Sun, 08 Dec 2013 14:59:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.142 with SMTP id v14ls1899005qeu.35.gmail; Sun, 08 Dec 2013 14:59:11 -0800 (PST) X-Received: by 10.221.51.206 with SMTP id vj14mr487154vcb.17.1386543551543; Sun, 08 Dec 2013 14:59:11 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id dl10si2866853veb.95.2013.12.08.14.59.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Dec 2013 14:59:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.47; Received: by mail-vb0-f47.google.com with SMTP id q12so11443vbe.6 for ; Sun, 08 Dec 2013 14:59:11 -0800 (PST) X-Received: by 10.58.144.168 with SMTP id sn8mr413522veb.33.1386543551443; Sun, 08 Dec 2013 14:59:11 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp65225vcz; Sun, 8 Dec 2013 14:59:11 -0800 (PST) X-Received: by 10.205.15.7 with SMTP id ps7mr1291361bkb.106.1386543548672; Sun, 08 Dec 2013 14:59:08 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id y3si2691218bkn.4.2013.12.08.14.59.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 08 Dec 2013 14:59:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VpnJb-0008Jb-4y; Sun, 08 Dec 2013 22:59:07 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 5/5] ui/cocoa: Fix code for starting QEMU via image file load dialog Date: Sun, 8 Dec 2013 22:59:06 +0000 Message-Id: <1386543546-31919-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386543546-31919-1-git-send-email-peter.maydell@linaro.org> References: <1386543546-31919-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- ui/cocoa.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 4ca1477..94bf729 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -834,18 +834,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]; }