util/cutils: Skip "." when looking for next directory component
PATCH 1/1 util/cutils: Skip "." when looking for next directory component
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 "/.".
---
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(-)
util/cutils.c +2 -1
@@ -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 ;
Signature · 1 line
2.30.0
Paolo Bonzini
AppliedQuoted 27 lines · 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 <[email protected]>---
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(-)util/cutils.c +0
-0
util/cutils.c static inline bool starts_with_prefix(const char *dir) · line 923
Quoted 9 lines
util/cutils.c +2
-1@@ -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