When configuring QEMU with --prefix=/, the generated QEMU executables
can't be relocated to other directories. Add an additional test logic
in starts_with_prefix() to handle this.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
util/cutils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/cutils.c b/util/cutils.c
index 42364039a5..676bd757ba 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -1021,7 +1021,8 @@ static inline bool starts_with_prefix(const char *dir)
#pragma GCC diagnostic ignored "-Warray-bounds="
#endif
return !memcmp(dir, CONFIG_PREFIX, prefix_len) &&
- (!dir[prefix_len] || G_IS_DIR_SEPARATOR(dir[prefix_len]));
+ (!dir[prefix_len] || G_IS_DIR_SEPARATOR(dir[prefix_len]) ||
+ !strcmp(CONFIG_PREFIX, "/"));
#pragma GCC diagnostic pop
}
--
2.34.1