From: Bin Meng <bin.m...@windriver.com>

Windows does not provide a setenv() API, but glib does.
Replace setenv() call with the glib version.

Signed-off-by: Bin Meng <bin.m...@windriver.com>
Reviewed-by: Thomas Huth <th...@redhat.com>
Message-Id: <20220824094029.1634519-2-bmeng...@gmail.com>
Signed-off-by: Thomas Huth <th...@redhat.com>
---
 tests/qtest/fuzz/generic_fuzz.c | 8 ++++----
 tests/qtest/libqtest.c          | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
index 447ffe8178..afc1d20355 100644
--- a/tests/qtest/fuzz/generic_fuzz.c
+++ b/tests/qtest/fuzz/generic_fuzz.c
@@ -994,16 +994,16 @@ static GString 
*generic_fuzz_predefined_config_cmdline(FuzzTarget *t)
     g_assert(t->opaque);
 
     config = t->opaque;
-    setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1);
+    g_setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1);
     if (config->argfunc) {
         args = config->argfunc();
-        setenv("QEMU_FUZZ_ARGS", args, 1);
+        g_setenv("QEMU_FUZZ_ARGS", args, 1);
         g_free(args);
     } else {
         g_assert_nonnull(config->args);
-        setenv("QEMU_FUZZ_ARGS", config->args, 1);
+        g_setenv("QEMU_FUZZ_ARGS", config->args, 1);
     }
-    setenv("QEMU_FUZZ_OBJECTS", config->objects, 1);
+    g_setenv("QEMU_FUZZ_OBJECTS", config->objects, 1);
     return generic_fuzz_cmdline(t);
 }
 
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 8c159eacf5..ad6860d774 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -1424,7 +1424,7 @@ QTestState *qtest_inproc_init(QTestState **s, bool log, 
const char* arch,
      * way, qtest_get_arch works for inproc qtest.
      */
     gchar *bin_path = g_strconcat("/qemu-system-", arch, NULL);
-    setenv("QTEST_QEMU_BINARY", bin_path, 0);
+    g_setenv("QTEST_QEMU_BINARY", bin_path, 0);
     g_free(bin_path);
 
     return qts;
-- 
2.31.1


Reply via email to