* [PATCH] util/cutils: Skip "." when looking for next directory component
@ 2021-02-08 20:57 Stefan Weil
2021-02-09 9:20 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2021-02-08 20:57 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Peter Maydell, qemu-devel, Stefan Weil
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;
--
2.30.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] util/cutils: Skip "." when looking for next directory component
2021-02-08 20:57 [PATCH] util/cutils: Skip "." when looking for next directory component Stefan Weil
@ 2021-02-09 9:20 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-02-09 9:20 UTC (permalink / raw)
To: Stefan Weil; +Cc: Peter Maydell, qemu-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-09 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.