From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH] util/cutils: Skip "." when looking for next directory component
Date: Tue, 9 Feb 2021 10:20:32 +0100 [thread overview]
Message-ID: <3b5af712-5d28-c54f-f23b-62ba568622f8@redhat.com> (raw)
In-Reply-To: <20210208205752.2488774-1-sw@weilnetz.de>
On 08/02/21 21:57, Stefan Weil wrote:
> When looking for the next directory component, a "." component is now skipped.
>
> This fixes the path(s) used for firmware lookup for the prefix == bindir case
> which is standard for QEMU on Windows and where the internally
> used bindir value ends with "/.".
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> This patch is required for Windows to get the firmware access right,
> but would also be needed for Linux with --bindir=/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 == '.' && (G_IS_DIR_SEPARATOR(dir[1]) || dir[1] == '\0'))) {
> dir++;
> }
> len = 0;
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2021-02-09 9:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-08 20:57 [PATCH] util/cutils: Skip "." when looking for next directory component Stefan Weil
2021-02-09 9:20 ` Paolo Bonzini [this message]
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=3b5af712-5d28-c54f-f23b-62ba568622f8@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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).