diff options
author | Stefan Weil <sw@weilnetz.de> | 2021-02-08 21:57:52 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-02-16 17:15:39 +0100 |
commit | 342e3a4f20653c2d419cc0e8fdc0b99dfea32fed (patch) | |
tree | ec8f85778c03a03c161706f0e08ddef460b904ee /util/cutils.c | |
parent | b0019c995e0397092d5db5caa8262b67036c2a89 (diff) | |
download | qemu-342e3a4f20653c2d419cc0e8fdc0b99dfea32fed.zip qemu-342e3a4f20653c2d419cc0e8fdc0b99dfea32fed.tar.gz qemu-342e3a4f20653c2d419cc0e8fdc0b99dfea32fed.tar.bz2 |
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 "/.".
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-Id: <20210208205752.2488774-1-sw@weilnetz.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/cutils.c')
-rw-r--r-- | util/cutils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cutils.c b/util/cutils.c index 0b5073b..70c7d6e 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; |