From patchwork Thu Oct 27 18:36:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 619206 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp504033pvb; Thu, 27 Oct 2022 12:06:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4f65Anc936IS/oPjXQZ4mlBYTN7DW1hIG8/e+QwbHugJzx8/6wN6+EMp4o766pAMtgL4zQ X-Received: by 2002:a05:622a:170a:b0:39c:e2ee:8e2f with SMTP id h10-20020a05622a170a00b0039ce2ee8e2fmr43551862qtk.148.1666897617444; Thu, 27 Oct 2022 12:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666897617; cv=none; d=google.com; s=arc-20160816; b=AIE5Sbdnwg/BPVJsEuJ+CVSwyDGseyibOUrA0RRBUShbM3RmwSXiEx29blzPyr4fNB dL+598h/Tx/uiIeiXGm4nTvYiBsHDgBdSn3PfFXFGmNJNuARlxAvA8/NBJXFAWDbniOm k0rnfao9phgz9l12bHyaiLscN8Uhu5nYH1rvCfQVSb05ql0eWDuMGag7YdQfCfdj2HU2 EP1GtLHWhCr9IAfdWEEdsZFjy1X0uzkCO7KTM0f4j3/86ZDspgMpAGeenEZ0gdrwThGA 6HQ6Ge/ikyOFFLK8+cwFnw2QPYkllcEiU4wLLdMs7kSuqbwUtGydJnDdpPKklr1BIlpH WP0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2E3Sx1MFwkAkShWDh4ro7HDDrVqIf4xAYuZL7Z9YHGw=; b=ORuTPuaqP+oNt5GGHhRLmdRaCeUHj/jxNSa8tVlfUdIbdY0FfpRMx/UmcSo1NWzoi3 FqFsWQqPBgi5HIvtVLshPcdBRz30XdMhozbFiVDIAaeUgl77o2DuRkglkDBZuvIrTE4K 0Rf12BySj3O1LeHw91aItoR2+th1MdiWM0h0vMM0hqdG1GhWS+2+gC9ez3Pv5mFFieQL ofrBBxOFChNfAMoUKYULky7LYuqpU98QSVl+7n7N/ZJG+XBOzs6RIrod4nfzw4V7Lfev o1YcI9YRB5QHcQqriPR5RTBIxwAgl+3ZS6nAedxiRO42F77zNR2CvcKKYj6Ypb8zxrp+ h/wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fbbf0Snw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTP id u184-20020a3760c1000000b006eed85cab11si1372088qkb.147.2022.10.27.12.06.57 for ; Thu, 27 Oct 2022 12:06:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fbbf0Snw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oo7mS-0002Oa-7c; Thu, 27 Oct 2022 14:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oo7kH-0001Mf-8t for qemu-devel@nongnu.org; Thu, 27 Oct 2022 14:36:50 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oo7kF-0003Le-91 for qemu-devel@nongnu.org; Thu, 27 Oct 2022 14:36:48 -0400 Received: by mail-wr1-x42e.google.com with SMTP id bp11so3670594wrb.9 for ; Thu, 27 Oct 2022 11:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2E3Sx1MFwkAkShWDh4ro7HDDrVqIf4xAYuZL7Z9YHGw=; b=fbbf0SnwcDGnN1rhzBRAk+qc6TUOfr+gNBcucuX3V3EWpVmh1yFMW5uErLkrRkWr6J H0FskIm/rv+voyO7axY4UR4hT3qIymKbIhtaNF3j1QWvMZjrZ1nuknvmb0nrcoO9dtce 4AvYl7lPSKxFn6+16m4Y6A4WZZz/3/XrgP0QXqxZDPHQj1s3HumWOWsTX14Z18x/I++O jmPMbkv9WrnECA27XV8WH9kp/gr5BSqhv8RaofJ2cF4Z4zkYs0XZKSMzpV48J5iTrBQm vcgtZZNUNmQWAW9k6o6nLY+ZKvA793cFubj2ItZJRrFx7qz8rO3ugONSq1W/ewz3jQO2 pInQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2E3Sx1MFwkAkShWDh4ro7HDDrVqIf4xAYuZL7Z9YHGw=; b=vZNauXRwjyGm+7MsiIrtZ5NwyLZarQ4avMvT0Tny+iyUt0b9r+76hY0u8h+gOKKUiZ LX1gxN/+981p3Jx92av1KdtqXcBe7KhfAc00NFCKgBtK9w47xDOAmHckfdXb8jAVuxS1 7sM0dOxarFINPnpGd0O08Xl/SLawVqDQwWZtfF5GTr7dBW6MxdzclcjoKOI/7RHKqzie Nz+lx3zc/bKfESzsS+PmaRCf3rttTHY0XIlUQ5/ZIYLzKCSNvVdBd7VI4Zf4sn4aziuq 0YgLBqw5tnUqbeHdN/DjRw4B5kJUyPuQCf9ls7HctjVUVU6NBLQexWH6mMefZcDPmsjW sOhA== X-Gm-Message-State: ACrzQf2ydQ3IQBxq7gKFl+lDQbdLUh0aXqkeugW+Ewh3W8lNmZTkRplb PZGlazHQtRuA0s9DaVT1BKTHmg== X-Received: by 2002:adf:c582:0:b0:22b:3c72:6b81 with SMTP id m2-20020adfc582000000b0022b3c726b81mr33257106wrg.320.1666895805786; Thu, 27 Oct 2022 11:36:45 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id bs1-20020a056000070100b002345cb2723esm1903064wrb.17.2022.10.27.11.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 11:36:41 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4C0111FFB7; Thu, 27 Oct 2022 19:36:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: fam@euphon.net, berrange@redhat.com, f4bug@amsat.org, aurelien@aurel32.net, pbonzini@redhat.com, stefanha@redhat.com, crosa@redhat.com, Bin Meng , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= , Richard Henderson Subject: [PATCH v4 10/30] semihosting/arm-compat-semi: Avoid using hardcoded /tmp Date: Thu, 27 Oct 2022 19:36:16 +0100 Message-Id: <20221027183637.2772968-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027183637.2772968-1-alex.bennee@linaro.org> References: <20221027183637.2772968-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng Reviewed-by: Alex Bennée Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20221006151927.2079583-2-bmeng.cn@gmail.com> --- semihosting/arm-compat-semi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index bfea9e9337..62d8bae97f 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -503,7 +503,8 @@ void do_common_semihosting(CPUState *cs) GET_ARG(0); GET_ARG(1); GET_ARG(2); - len = asprintf(&s, "/tmp/qemu-%x%02x", getpid(), (int)arg1 & 0xff); + len = asprintf(&s, "%s/qemu-%x%02x", g_get_tmp_dir(), + getpid(), (int)arg1 & 0xff); if (len < 0) { common_semi_set_ret(cs, -1); break;