From patchwork Thu Oct 27 18:36:18 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: 619199 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp496369pvb; Thu, 27 Oct 2022 11:53:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wRjzQLQymiWpafbogoOuIfJ45rK1M2Qni2rHArP+TNhoKfNxZIQaE/K8XTjRDrP0k33/A X-Received: by 2002:ad4:5962:0:b0:4bb:6c2f:cbc2 with SMTP id eq2-20020ad45962000000b004bb6c2fcbc2mr20269618qvb.101.1666896789575; Thu, 27 Oct 2022 11:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666896789; cv=none; d=google.com; s=arc-20160816; b=Z9n+k5hqFqoFHmsk0qDUykOQvScuRcnxIS5hMOSEd2cFICHG7XEospUzd3jNcGqvQY zRo/FlKiMEj6QNQdsGLmjJ+KHTQgUh07vy9GsFBx5eP/+g2o9ffRlfkqF3YiGkEYl6zq pJRP+L8+hmOR0v7GosrWENpiRbQCSBIjcVSf05HjEAd6szdKBzlKUeGBfxLG1iY3uACV ZLSgQB+ng+tmN6KJ8tvFkzq1IHTYac/zRHMz31cA6JJCqlEYdmpEbYgfQJ82WoIHMvyh hCYGQ1oh37+4aPaRXrhbYaKnZ9M4wU8e0PRdfoudnp6//sVRG3WTIfD0bk9YuMiSlOzH sgVQ== 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=QqBhpviWM7Tr3buMaeROL2/NOOiB4kCmWYZZ1xMVnXQ=; b=krigORhd1YB/+xGKVNSyQq9eKDzL8VDoIvhKjM6Bhqdr335iMBiqZ4mvrVoezcBBzZ EJfRrqTGBR3B8d2z8NEJP1Y3k6TbCWQ+M2BNxhu1Qx5z3xWXEqupf0pNzQYm0os+T0lJ NwHn8Rkmi4u2qdLj2wcPMKMhE7AVRHmbnGMl78MScQWkSRNAkY55Q3Mv3KDopL2Smz8T ndike9S5t2GMFi2vVA/Nh4/WNQcNJ2Z9mc/NOa5FUfjNUl9Csc7p7E+GTJUfpDYi/A5c eOZa3uNK+khOQuB3CeIUOgak2ww0ElIxSNv40nxmTB7QcuJKauG9wIkS7l1+BF3+3l7s 1+rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hZqAXAsp; 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 h16-20020a05622a171000b0039cc35b784csi1532572qtk.270.2022.10.27.11.53.09 for ; Thu, 27 Oct 2022 11:53:09 -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=hZqAXAsp; 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 1oo7nP-0002ca-15; Thu, 27 Oct 2022 14:40:03 -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 1oo7kQ-0001SH-P1 for qemu-devel@nongnu.org; Thu, 27 Oct 2022 14:36:58 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oo7kG-0003Lq-VT for qemu-devel@nongnu.org; Thu, 27 Oct 2022 14:36:58 -0400 Received: by mail-wr1-x42c.google.com with SMTP id l14so3700526wrw.2 for ; Thu, 27 Oct 2022 11:36:48 -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=QqBhpviWM7Tr3buMaeROL2/NOOiB4kCmWYZZ1xMVnXQ=; b=hZqAXAspu5AASpvWJ4Rqhm/whojargirDT3WGIuMGL5+HRzj42T24oULSvG9AUqlBR yZ1QsgEH8v/ay8NtAXbKOOcD1nzKxQsrDRGDFDSynaKKEDK84RszOHc+hbhe2SOor3D+ JBguiqN1brTB46xEx8YPWKSSxhHqKTaEsCJC/T2OvDYZWXGo66d6SIPMMSWwwC3vJfzb WTiYGzgOrNV+fkbQi69+0ehmZafRC/M8Fm4bJrGES+1Fz6C9oZTMV0Rxmm33LVn4KFE5 3bxY54VSdSg2Byc0U0Dt7+dCeO+XJJaA44A2G8a6s+EVvdFjDN4A9ZV2YMrXIf33JTl1 XDKQ== 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=QqBhpviWM7Tr3buMaeROL2/NOOiB4kCmWYZZ1xMVnXQ=; b=EXmtSKlJ4n9jdY/s1G24JtM6IWz6TrpZ5t6+z0w3VlwNivhE0ot8J94UAwe2usMOwg N3eQJ0NSWroZTtU1y2JFBzuoA5ZJA33h+vGyWk7si1VwjpJqy2+G7GmP4G6gGgl3S/rR BgmEUculfcr4yq5OtaLNrmB7TgZAr5KxQc4pocMV3zrj4thunbpf4ShXoUQocNTxT0YG ajs1NoQ2RjndvG7HtLmjsyjq1jeewuV7p4IyhZr1VGGLz5Ghfm6b4agRoKOVB/XkQkY+ 48UZ7SUa0ktM4MNCtWOLhqFc0vdcmfLCx0OIhGnGdQVgKIyH0d+5uoWA49T6rksO3yEb 7+KA== X-Gm-Message-State: ACrzQf0fK7ahKvtkeYnZrzRk51IFRaY4jbHzCsQvaJt9uU0ULjJD6koK XgO9n+QfEc7hBf6tTm+xW9EsaQ== X-Received: by 2002:adf:9c87:0:b0:232:a0fb:ea5f with SMTP id d7-20020adf9c87000000b00232a0fbea5fmr33496741wre.473.1666895807004; Thu, 27 Oct 2022 11:36:47 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id j26-20020a5d453a000000b0022cd96b3ba6sm1966196wra.90.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 7A0F51FFC3; 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?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , =?utf-8?q?Alex_Ben?= =?utf-8?q?n=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= Subject: [PATCH v4 12/30] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files Date: Thu, 27 Oct 2022 19:36:18 +0100 Message-Id: <20221027183637.2772968-13-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::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.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 Replace the existing logic to get the directory for temporary files with g_get_tmp_dir(), which works for win32 too. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20221006151927.2079583-4-bmeng.cn@gmail.com> --- util/qemu-sockets.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 83f4bd6fd2..0c41ca9e42 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -919,9 +919,8 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, if (saddr->path[0] || abstract) { path = saddr->path; } else { - const char *tmpdir = getenv("TMPDIR"); - tmpdir = tmpdir ? tmpdir : "/tmp"; - path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir); + path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", + g_get_tmp_dir()); } pathlen = strlen(path);