blob: 74e9ba56cef0c01b65fbefd20868792cf2d7db11 [file] [log] [blame]
Andrew Geisslerd25ed322020-06-27 00:28:28 -05001qemu: search for datadir as in version 4.2
2
3os_find_datadir() was changed after the 4.2 release. We need to check for
4../share/qemu relative to the executable because that is where the runqemu
5configuration assumes it will be.
6
7Upstream-Status: Submitted [qemu-devel@nongnu.org]
8
9Signed-off-by: Joe Slater <joe.slater@windriver.com>
10
11
12--- a/os-posix.c
13+++ b/os-posix.c
14@@ -82,8 +82,9 @@ void os_setup_signal_handling(void)
15
16 /*
17 * Find a likely location for support files using the location of the binary.
18+ * Typically, this would be "$bindir/../share/qemu".
19 * When running from the build tree this will be "$bindir/../pc-bios".
20- * Otherwise, this is CONFIG_QEMU_DATADIR.
21+ * Otherwise, this is CONFIG_QEMU_DATADIR as constructed by configure.
22 */
23 char *os_find_datadir(void)
24 {
25@@ -93,6 +94,12 @@ char *os_find_datadir(void)
26 exec_dir = qemu_get_exec_dir();
27 g_return_val_if_fail(exec_dir != NULL, NULL);
28
29+ dir = g_build_filename(exec_dir, "..", "share", "qemu", NULL);
30+ if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
31+ return g_steal_pointer(&dir);
32+ }
33+ g_free(dir); /* no autofree this time */
34+
35 dir = g_build_filename(exec_dir, "..", "pc-bios", NULL);
36 if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
37 return g_steal_pointer(&dir);