X-Git-Url: https://repo.jachan.dev/qemu.git/blobdiff_plain/5a3be00c9a0eb0f80a2ac5e8e57ed08e619184fa..0444a3b7935f6e09dfddf00411840e70f6fd933e:/os-posix.c diff --git a/os-posix.c b/os-posix.c index 87e2a1696d..c6ddb7d830 100644 --- a/os-posix.c +++ b/os-posix.c @@ -23,24 +23,21 @@ * THE SOFTWARE. */ -#include -#include -#include -#include +#include "qemu/osdep.h" #include /*needed for MAP_POPULATE before including qemu-options.h */ -#include #include #include #include /* Needed early for CONFIG_BSD etc. */ -#include "config-host.h" #include "sysemu/sysemu.h" #include "net/slirp.h" #include "qemu-options.h" #include "qemu/rcu.h" #include "qemu/error-report.h" +#include "qemu/log.h" +#include "qemu/cutils.h" #ifdef CONFIG_LINUX #include @@ -92,7 +89,7 @@ char *os_find_datadir(void) if (exec_dir == NULL) { return NULL; } - dir = dirname(exec_dir); + dir = g_path_get_dirname(exec_dir); max_len = strlen(dir) + MAX(strlen(SHARE_SUFFIX), strlen(BUILD_SUFFIX)) + 1; @@ -106,6 +103,7 @@ char *os_find_datadir(void) } } + g_free(dir); g_free(exec_dir); return res; } @@ -279,7 +277,10 @@ void os_setup_post(void) dup2(fd, 0); dup2(fd, 1); - dup2(fd, 2); + /* In case -D is given do not redirect stderr to /dev/null */ + if (!qemu_logfile) { + dup2(fd, 2); + } close(fd);