From nobody Fri May 17 10:13:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1612827477; cv=none; d=zohomail.com; s=zohoarc; b=S7+NYThFzY+5kIWpaM5QlqiUoIryzwR97UX22nj+NmnRk3PKeKjvi7HSAI0DwelvBjhHbrrHRtJybt9TiiaKdyNk8tb3+iHt8kY1zJo8d/+VpW8psffBwtDDlmbewQ1QOyBZcLxBQS89vzHcd6VTja6svnJpy9HSfona1ph3pNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612827477; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=sjxBa6WYM1W0XfeYXRZuYXkrf3Gzrj9OWX2kbGE7x5s=; b=VEOoHfBynSADCR8t6UQ+19fNV0ISFkIjauZzMOQzwKayFezxxJ/D25xQikyc+qAcK+vPc1P712kVvvwoH53GQjRl/w7sw6zK8kJq9DE2XElkiN/+5GkaV22XjwuL84jnX6kSZApyZl8hlcGfHpYfYvPUpEFP9TPqksSnN+sOEUU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612827477408510.28060471283834; Mon, 8 Feb 2021 15:37:57 -0800 (PST) Received: from localhost ([::1]:46428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9G6N-0002MO-B0 for importer@patchew.org; Mon, 08 Feb 2021 18:37:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9Dbl-0000So-M0 for qemu-devel@nongnu.org; Mon, 08 Feb 2021 15:58:09 -0500 Received: from mail.weilnetz.de ([37.120.169.71]:44252 helo=mail.v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9Dbj-0002cT-0y for qemu-devel@nongnu.org; Mon, 08 Feb 2021 15:58:09 -0500 Received: from qemu.weilnetz.de (qemu.weilnetz.de [188.68.58.204]) by mail.v2201612906741603.powersrv.de (Postfix) with ESMTP id 19EE1DA0250; Mon, 8 Feb 2021 21:58:04 +0100 (CET) Received: by qemu.weilnetz.de (Postfix, from userid 1000) id E66B9460149; Mon, 8 Feb 2021 21:58:03 +0100 (CET) From: Stefan Weil To: Paolo Bonzini Subject: [PATCH] util/cutils: Skip "." when looking for next directory component Date: Mon, 8 Feb 2021 21:57:52 +0100 Message-Id: <20210208205752.2488774-1-sw@weilnetz.de> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=37.120.169.71; envelope-from=stefan@weilnetz.de; helo=mail.v2201612906741603.powersrv.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Stefan Weil Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" When looking for the next directory component, a "." component is now skipp= ed. This fixes the path(s) used for firmware lookup for the prefix =3D=3D bindi= r case which is standard for QEMU on Windows and where the internally used bindir value ends with "/.". Signed-off-by: Stefan Weil --- This patch is required for Windows to get the firmware access right, but would also be needed for Linux with --bindir=3D/usr/local which currently results in a search path like /usr/local/../share/qemu-firmware. I noticed that qemu-firmware is not used during the installation. What is the purpose of that extra search path? Stefan util/cutils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/cutils.c b/util/cutils.c index 0b5073b330..70c7d6efbd 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -916,7 +916,8 @@ static inline bool starts_with_prefix(const char *dir) static inline const char *next_component(const char *dir, int *p_len) { int len; - while (*dir && G_IS_DIR_SEPARATOR(*dir)) { + while ((*dir && G_IS_DIR_SEPARATOR(*dir)) || + (*dir =3D=3D '.' && (G_IS_DIR_SEPARATOR(dir[1]) || dir[1] =3D= =3D '\0'))) { dir++; } len =3D 0; --=20 2.30.0