[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 49/92] qga: relocate path to default configuration and hook
From: |
Paolo Bonzini |
Subject: |
[PULL 49/92] qga: relocate path to default configuration and hook |
Date: |
Thu, 24 Sep 2020 05:22:31 -0400 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qga/main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/qga/main.c b/qga/main.c
index 3febf3b0fd..740f5f7303 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -29,6 +29,7 @@
#include "qapi/error.h"
#include "channel.h"
#include "qemu/bswap.h"
+#include "qemu/cutils.h"
#include "qemu/help_option.h"
#include "qemu/sockets.h"
#include "qemu/systemd.h"
@@ -968,7 +969,7 @@ static void config_load(GAConfig *config)
{
GError *gerr = NULL;
GKeyFile *keyfile;
- const char *conf = g_getenv("QGA_CONF") ?: QGA_CONF_DEFAULT;
+ g_autofree char *conf = g_strdup(g_getenv("QGA_CONF")) ?:
get_relocated_path(QGA_CONF_DEFAULT);
/* read system config */
keyfile = g_key_file_new();
@@ -1027,7 +1028,7 @@ end:
if (gerr &&
!(gerr->domain == G_FILE_ERROR && gerr->code == G_FILE_ERROR_NOENT)) {
g_critical("error loading configuration from path: %s, %s",
- QGA_CONF_DEFAULT, gerr->message);
+ conf, gerr->message);
exit(EXIT_FAILURE);
}
g_clear_error(&gerr);
@@ -1141,7 +1142,7 @@ static void config_parse(GAConfig *config, int argc, char
**argv)
#ifdef CONFIG_FSFREEZE
case 'F':
g_free(config->fsfreeze_hook);
- config->fsfreeze_hook = g_strdup(optarg ?:
QGA_FSFREEZE_HOOK_DEFAULT);
+ config->fsfreeze_hook = optarg ? g_strdup(optarg) :
get_relocated_path(QGA_FSFREEZE_HOOK_DEFAULT);
break;
#endif
case 't':
@@ -1463,6 +1464,7 @@ int main(int argc, char **argv)
config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL;
+ qemu_init_exec_dir(argv[0]);
qga_qmp_init_marshal(&ga_commands);
init_dfl_pathnames();
--
2.26.2
- [PULL 42/92] cutils: introduce get_relocated_path, (continued)
- [PULL 42/92] cutils: introduce get_relocated_path, Paolo Bonzini, 2020/09/24
- [PULL 44/92] module: relocate path to modules, Paolo Bonzini, 2020/09/24
- [PULL 51/92] configure: use a platform-neutral prefix, Paolo Bonzini, 2020/09/24
- [PULL 50/92] ui: relocate paths to icons and translations, Paolo Bonzini, 2020/09/24
- [PULL 48/92] qemu-bridge-helper: relocate path to default ACL, Paolo Bonzini, 2020/09/24
- [PULL 52/92] hw/i386/q35: Remove unreachable Xen code on Q35 machine, Paolo Bonzini, 2020/09/24
- [PULL 43/92] oslib-posix: relocate path to /var, Paolo Bonzini, 2020/09/24
- [PULL 47/92] vl: relocate path to configuration file, Paolo Bonzini, 2020/09/24
- [PULL 45/92] net: relocate paths to helpers and scripts, Paolo Bonzini, 2020/09/24
- [PULL 53/92] exec: Remove MemoryRegion::global_locking field, Paolo Bonzini, 2020/09/24
- [PULL 49/92] qga: relocate path to default configuration and hook,
Paolo Bonzini <=
- [PULL 55/92] meson: fix installation of keymaps, Paolo Bonzini, 2020/09/24
- [PULL 54/92] checkpatch: avoid error on cover letter files, Paolo Bonzini, 2020/09/24
- [PULL 58/92] tests/tcg: reinstate or replace desired parts of rules.mak, Paolo Bonzini, 2020/09/24
- [PULL 57/92] oss-fuzz: move linker arg to fix coverage-build, Paolo Bonzini, 2020/09/24
- [PULL 56/92] configure: fix performance regression due to PIC objects, Paolo Bonzini, 2020/09/24
- [PULL 63/92] smp: drop support for deprecated (invalid topologies), Paolo Bonzini, 2020/09/24
- [PULL 59/92] configure: cleanup invocation of submodule Make, Paolo Bonzini, 2020/09/24
- [PULL 61/92] configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS, Paolo Bonzini, 2020/09/24
- [PULL 62/92] configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson, Paolo Bonzini, 2020/09/24
- [PULL 60/92] configure: cleanup CFLAGS and LDFLAGS for submodules, Paolo Bonzini, 2020/09/24