From 0b7af7d54b3adc0e37e163a9fa54960e0c028aee Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 13 Apr 2022 12:48:11 +0100 Subject: [PATCH] trivial: Ignore the return value of setenv() in most cases This makes Coverity happy. --- libfwupd/fwupd-self-test.c | 4 +-- libfwupdplugin/fu-fuzzer-firmware.c.in | 2 +- libfwupdplugin/fu-self-test.c | 24 +++++++++--------- plugins/acpi-dmar/fu-self-test.c | 2 +- plugins/acpi-facp/fu-self-test.c | 2 +- plugins/acpi-ivrs/fu-self-test.c | 2 +- plugins/acpi-phat/fu-self-test.c | 2 +- plugins/dell/fu-plugin-dell.c | 4 +-- plugins/dell/fu-self-test.c | 8 +++--- plugins/dfu/fu-dfu-self-test.c | 2 +- plugins/dfu/fu-dfu-tool.c | 2 +- plugins/lenovo-thinklmi/fu-self-test.c | 12 ++++----- plugins/linux-swap/fu-self-test.c | 2 +- plugins/mtd/fu-self-test.c | 2 +- plugins/redfish/fu-self-test.c | 8 +++--- plugins/tpm/fu-self-test.c | 14 ++++++----- plugins/tpm/fu-tpm-eventlog.c | 4 +-- plugins/tpm/fu-tpm-v2-device.c | 2 +- plugins/uefi-capsule/fu-self-test.c | 8 +++--- plugins/uefi-capsule/fu-uefi-tool.c | 2 +- plugins/uefi-dbx/fu-dbxtool.c | 2 +- plugins/uefi-dbx/fu-self-test.c | 2 +- plugins/wacom-usb/fu-self-test.c | 2 +- src/fu-config.c | 2 +- src/fu-debug.c | 6 ++--- src/fu-self-test.c | 34 +++++++++++++------------- src/fu-tool.c | 4 +-- src/fu-util.c | 6 ++--- 28 files changed, 84 insertions(+), 82 deletions(-) diff --git a/libfwupd/fwupd-self-test.c b/libfwupd/fwupd-self-test.c index 3c5668c5e..281c2eb5c 100644 --- a/libfwupd/fwupd-self-test.c +++ b/libfwupd/fwupd-self-test.c @@ -592,7 +592,7 @@ fwupd_client_remotes_func(void) g_autoptr(GPtrArray) array = NULL; remotesdir = g_test_build_filename(G_TEST_DIST, "tests", "remotes.d", NULL); - g_setenv("FU_SELF_TEST_REMOTES_DIR", remotesdir, TRUE); + (void)g_setenv("FU_SELF_TEST_REMOTES_DIR", remotesdir, TRUE); client = fwupd_client_new(); @@ -916,7 +916,7 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/fwupd/enums", fwupd_enums_func); diff --git a/libfwupdplugin/fu-fuzzer-firmware.c.in b/libfwupdplugin/fu-fuzzer-firmware.c.in index de161f0c4..f6e294fd7 100644 --- a/libfwupdplugin/fu-fuzzer-firmware.c.in +++ b/libfwupdplugin/fu-fuzzer-firmware.c.in @@ -15,7 +15,7 @@ LLVMFuzzerTestOneInput(const guint8 *data, gsize size) g_autoptr(GBytes) fw = g_bytes_new(data, size); gboolean ret; - g_setenv("G_DEBUG", "fatal-criticals", FALSE); + (void)g_setenv("G_DEBUG", "fatal-criticals", FALSE); ret = fu_firmware_parse(firmware, fw, FWUPD_INSTALL_FLAG_NONE, NULL); if (!ret && fu_firmware_has_flag(firmware, FU_FIRMWARE_FLAG_HAS_CHECKSUM)) { g_clear_object(&firmware); diff --git a/libfwupdplugin/fu-self-test.c b/libfwupdplugin/fu-self-test.c index 7b10b84b8..fef02220f 100644 --- a/libfwupdplugin/fu-self-test.c +++ b/libfwupdplugin/fu-self-test.c @@ -358,7 +358,7 @@ fu_smbios_func(void) /* these tests will not write */ testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); smbios = fu_smbios_new(); ret = fu_smbios_setup(smbios, &error); @@ -633,7 +633,7 @@ fu_hwids_func(void) /* these tests will not write */ testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); smbios = fu_smbios_new(); ret = fu_smbios_setup(smbios, &error); @@ -888,17 +888,17 @@ fu_common_kernel_lockdown_func(void) #endif old_kernel_dir = g_test_build_filename(G_TEST_DIST, "tests", "lockdown", NULL); - g_setenv("FWUPD_SYSFSSECURITYDIR", old_kernel_dir, TRUE); + (void)g_setenv("FWUPD_SYSFSSECURITYDIR", old_kernel_dir, TRUE); ret = fu_common_kernel_locked_down(); g_assert_false(ret); locked_dir = g_test_build_filename(G_TEST_DIST, "tests", "lockdown", "locked", NULL); - g_setenv("FWUPD_SYSFSSECURITYDIR", locked_dir, TRUE); + (void)g_setenv("FWUPD_SYSFSSECURITYDIR", locked_dir, TRUE); ret = fu_common_kernel_locked_down(); g_assert_true(ret); none_dir = g_test_build_filename(G_TEST_DIST, "tests", "lockdown", "none", NULL); - g_setenv("FWUPD_SYSFSSECURITYDIR", none_dir, TRUE); + (void)g_setenv("FWUPD_SYSFSSECURITYDIR", none_dir, TRUE); ret = fu_common_kernel_locked_down(); g_assert_false(ret); } @@ -3124,7 +3124,7 @@ fu_efivar_func(void) /* these tests will write */ sysfsfwdir = g_test_build_filename(G_TEST_BUILT, "tests", NULL); - g_setenv("FWUPD_SYSFSFWDIR", sysfsfwdir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", sysfsfwdir, TRUE); /* check supported */ ret = fu_efivar_supported(&error); @@ -3950,14 +3950,14 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_DATADIR", testdatadir, TRUE); - g_setenv("FWUPD_PLUGINDIR", testdatadir, TRUE); - g_setenv("FWUPD_SYSCONFDIR", testdatadir, TRUE); - g_setenv("FWUPD_OFFLINE_TRIGGER", "/tmp/fwupd-self-test/system-update", TRUE); - g_setenv("FWUPD_LOCALSTATEDIR", "/tmp/fwupd-self-test/var", TRUE); + (void)g_setenv("FWUPD_DATADIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_PLUGINDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSCONFDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_OFFLINE_TRIGGER", "/tmp/fwupd-self-test/system-update", TRUE); + (void)g_setenv("FWUPD_LOCALSTATEDIR", "/tmp/fwupd-self-test/var", TRUE); g_test_add_func("/fwupd/common{strnsplit}", fu_common_strnsplit_func); g_test_add_func("/fwupd/common{memmem}", fu_common_memmem_func); diff --git a/plugins/acpi-dmar/fu-self-test.c b/plugins/acpi-dmar/fu-self-test.c index ab4228504..877c9f77c 100644 --- a/plugins/acpi-dmar/fu-self-test.c +++ b/plugins/acpi-dmar/fu-self-test.c @@ -63,7 +63,7 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/acpi-dmar/opt-in", fu_acpi_dmar_opt_in_func); diff --git a/plugins/acpi-facp/fu-self-test.c b/plugins/acpi-facp/fu-self-test.c index 58adbfb10..c9c1fa896 100644 --- a/plugins/acpi-facp/fu-self-test.c +++ b/plugins/acpi-facp/fu-self-test.c @@ -63,7 +63,7 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/acpi-facp/s2i{disabled}", fu_acpi_facp_s2i_disabled_func); diff --git a/plugins/acpi-ivrs/fu-self-test.c b/plugins/acpi-ivrs/fu-self-test.c index 5534cccec..bb4429790 100644 --- a/plugins/acpi-ivrs/fu-self-test.c +++ b/plugins/acpi-ivrs/fu-self-test.c @@ -64,7 +64,7 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/acpi-ivrs/dma-remap-support", fu_acpi_ivrs_dma_remap_func); diff --git a/plugins/acpi-phat/fu-self-test.c b/plugins/acpi-phat/fu-self-test.c index 077fb5515..05996d186 100644 --- a/plugins/acpi-phat/fu-self-test.c +++ b/plugins/acpi-phat/fu-self-test.c @@ -42,7 +42,7 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/acpi-phat/parse", fu_acpi_phat_parse_func); diff --git a/plugins/dell/fu-plugin-dell.c b/plugins/dell/fu-plugin-dell.c index fd5ca4262..3b8b70dab 100644 --- a/plugins/dell/fu-plugin-dell.c +++ b/plugins/dell/fu-plugin-dell.c @@ -871,9 +871,9 @@ fu_plugin_dell_init(FuPlugin *plugin) data->smi_obj = g_malloc0(sizeof(FuDellSmiObj)); if (g_getenv("FWUPD_DELL_VERBOSE") != NULL) - g_setenv("LIBSMBIOS_C_DEBUG_OUTPUT_ALL", "1", TRUE); + (void)g_setenv("LIBSMBIOS_C_DEBUG_OUTPUT_ALL", "1", TRUE); else - g_setenv("TSS2_LOG", "esys+none,tcti+none", FALSE); + (void)g_setenv("TSS2_LOG", "esys+none,tcti+none", FALSE); if (fu_dell_supported(plugin)) data->smi_obj->smi = dell_smi_factory(DELL_SMI_DEFAULTS); data->smi_obj->fake_smbios = FALSE; diff --git a/plugins/dell/fu-self-test.c b/plugins/dell/fu-self-test.c index 677f14fd9..e659c9f8a 100644 --- a/plugins/dell/fu-self-test.c +++ b/plugins/dell/fu-self-test.c @@ -566,13 +566,13 @@ main(int argc, char **argv) /* change path */ testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); /* change behavior */ sysfsdir = fu_common_get_path(FU_PATH_KIND_SYSFSDIR_FW); - g_setenv("FWUPD_UEFI_ESP_PATH", sysfsdir, TRUE); - g_setenv("FWUPD_UEFI_TEST", "1", TRUE); - g_setenv("FWUPD_DELL_FAKE_SMBIOS", "1", FALSE); + (void)g_setenv("FWUPD_UEFI_ESP_PATH", sysfsdir, TRUE); + (void)g_setenv("FWUPD_UEFI_TEST", "1", TRUE); + (void)g_setenv("FWUPD_DELL_FAKE_SMBIOS", "1", FALSE); /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); diff --git a/plugins/dfu/fu-dfu-self-test.c b/plugins/dfu/fu-dfu-self-test.c index 556943e68..2a16497bf 100644 --- a/plugins/dfu/fu-dfu-self-test.c +++ b/plugins/dfu/fu-dfu-self-test.c @@ -158,7 +158,7 @@ main(int argc, char **argv) g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); /* log everything */ - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", FALSE); /* tests go here */ g_test_add_func("/dfu/enums", fu_dfu_enums_func); diff --git a/plugins/dfu/fu-dfu-tool.c b/plugins/dfu/fu-dfu-tool.c index 748a7a90e..ca0f6c265 100644 --- a/plugins/dfu/fu-dfu-tool.c +++ b/plugins/dfu/fu-dfu-tool.c @@ -832,7 +832,7 @@ main(int argc, char *argv[]) /* set verbose? */ if (verbose) - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", FALSE); /* version */ if (version) { diff --git a/plugins/lenovo-thinklmi/fu-self-test.c b/plugins/lenovo-thinklmi/fu-self-test.c index bad7441f6..c59bc1895 100644 --- a/plugins/lenovo-thinklmi/fu-self-test.c +++ b/plugins/lenovo-thinklmi/fu-self-test.c @@ -96,7 +96,7 @@ fu_plugin_lenovo_thinklmi_bootorder_locked(gconstpointer user_data) g_autoptr(FuDevice) dev = NULL; g_autofree gchar *test_dir = g_test_build_filename(G_TEST_DIST, "tests", "firmware-attributes", "locked", NULL); - g_setenv("FWUPD_SYSFSFWATTRIBDIR", test_dir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWATTRIBDIR", test_dir, TRUE); dev = fu_test_probe_fake_esrt(self); fu_plugin_runner_device_register(self->plugin_lenovo_thinklmi, dev); @@ -110,7 +110,7 @@ fu_plugin_lenovo_thinklmi_bootorder_unlocked(gconstpointer user_data) g_autoptr(FuDevice) dev = NULL; g_autofree gchar *test_dir = g_test_build_filename(G_TEST_DIST, "tests", "firmware-attributes", "unlocked", NULL); - g_setenv("FWUPD_SYSFSFWATTRIBDIR", test_dir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWATTRIBDIR", test_dir, TRUE); dev = fu_test_probe_fake_esrt(self); fu_plugin_runner_device_register(self->plugin_lenovo_thinklmi, dev); @@ -145,16 +145,16 @@ main(int argc, char **argv) /* starting thinklmi dir to make startup pass */ test_dir = g_test_build_filename(G_TEST_DIST, "tests", "firmware-attributes", "locked", NULL); - g_setenv("FWUPD_SYSFSFWATTRIBDIR", test_dir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWATTRIBDIR", test_dir, TRUE); /* starting ESRT path */ testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); /* change behavior of UEFI plugin for test mode */ sysfsdir = fu_common_get_path(FU_PATH_KIND_SYSFSDIR_FW); - g_setenv("FWUPD_UEFI_ESP_PATH", sysfsdir, TRUE); - g_setenv("FWUPD_UEFI_TEST", "1", TRUE); + (void)g_setenv("FWUPD_UEFI_ESP_PATH", sysfsdir, TRUE); + (void)g_setenv("FWUPD_UEFI_TEST", "1", TRUE); /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); diff --git a/plugins/linux-swap/fu-self-test.c b/plugins/linux-swap/fu-self-test.c index 9b9cbab4c..01e50f2c6 100644 --- a/plugins/linux-swap/fu-self-test.c +++ b/plugins/linux-swap/fu-self-test.c @@ -75,7 +75,7 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/linux-swap/none", fu_linux_swap_none_func); diff --git a/plugins/mtd/fu-self-test.c b/plugins/mtd/fu-self-test.c index 9d23f5c23..57919abff 100644 --- a/plugins/mtd/fu-self-test.c +++ b/plugins/mtd/fu-self-test.c @@ -81,7 +81,7 @@ int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); - g_setenv("FWUPD_MTD_VERBOSE", "1", TRUE); + (void)g_setenv("FWUPD_MTD_VERBOSE", "1", TRUE); g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); g_test_add_func("/mtd/device", fu_test_mtd_device_func); return g_test_run(); diff --git a/plugins/redfish/fu-self-test.c b/plugins/redfish/fu-self-test.c index c507fabc8..4d19e560f 100644 --- a/plugins/redfish/fu-self-test.c +++ b/plugins/redfish/fu-self-test.c @@ -375,13 +375,13 @@ main(int argc, char **argv) g_test_init(&argc, &argv, NULL); - g_setenv("FWUPD_REDFISH_VERBOSE", "1", TRUE); + (void)g_setenv("FWUPD_REDFISH_VERBOSE", "1", TRUE); testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); smbios_data_fn = g_build_filename(testdatadir, "redfish-smbios.bin", NULL); - g_setenv("FWUPD_REDFISH_SMBIOS_DATA", smbios_data_fn, TRUE); - g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); - g_setenv("CONFIGURATION_DIRECTORY", testdatadir, TRUE); + (void)g_setenv("FWUPD_REDFISH_SMBIOS_DATA", smbios_data_fn, TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); + (void)g_setenv("CONFIGURATION_DIRECTORY", testdatadir, TRUE); g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); fu_test_self_init(self); diff --git a/plugins/tpm/fu-self-test.c b/plugins/tpm/fu-self-test.c index 665dd9e20..39c7c8aac 100644 --- a/plugins/tpm/fu-self-test.c +++ b/plugins/tpm/fu-self-test.c @@ -85,7 +85,7 @@ fu_tpm_device_2_0_func(void) g_autoptr(GPtrArray) pcr0s = NULL; g_autoptr(GPtrArray) pcrXs = NULL; const gchar *tpm_server_running = g_getenv("TPM_SERVER_RUNNING"); - g_setenv("FWUPD_FORCE_TPM2", "1", TRUE); + (void)g_setenv("FWUPD_FORCE_TPM2", "1", TRUE); #ifdef HAVE_GETUID if (tpm_server_running == NULL && (getuid() != 0 || geteuid() != 0)) { @@ -207,7 +207,7 @@ fu_tpm_empty_pcr_func(void) /* save environment and set broken PCR data */ environ_old = g_get_environ(); testdatadir = g_test_build_filename(G_TEST_DIST, "tests", "empty_pcr", NULL); - g_setenv("FWUPD_SYSFSTPMDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSFSTPMDIR", testdatadir, TRUE); /* load the plugin */ pluginfn = g_test_build_filename(G_TEST_BUILT, "libfu_plugin_tpm." G_MODULE_SUFFIX, NULL); @@ -228,7 +228,9 @@ fu_tpm_empty_pcr_func(void) FWUPD_SECURITY_ATTR_RESULT_NOT_VALID); /* restore default environment */ - g_setenv("FWUPD_SYSFSTPMDIR", g_environ_getenv(environ_old, "FWUPD_SYSFSTPMDIR"), TRUE); + (void)g_setenv("FWUPD_SYSFSTPMDIR", + g_environ_getenv(environ_old, "FWUPD_SYSFSTPMDIR"), + TRUE); } int @@ -239,12 +241,12 @@ main(int argc, char **argv) g_test_init(&argc, &argv, NULL); testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_SYSFSTPMDIR", testdatadir, TRUE); - g_setenv("FWUPD_UEFI_TEST", "1", TRUE); + (void)g_setenv("FWUPD_SYSFSTPMDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_UEFI_TEST", "1", TRUE); /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/tpm/pcrs1.2", fu_tpm_device_1_2_func); diff --git a/plugins/tpm/fu-tpm-eventlog.c b/plugins/tpm/fu-tpm-eventlog.c index ebaeec5b8..212dd77de 100644 --- a/plugins/tpm/fu-tpm-eventlog.c +++ b/plugins/tpm/fu-tpm-eventlog.c @@ -140,8 +140,8 @@ main(int argc, char *argv[]) /* set verbose? */ if (verbose) { - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); - g_setenv("FWUPD_TPM_EVENTLOG_VERBOSE", "1", FALSE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + (void)g_setenv("FWUPD_TPM_EVENTLOG_VERBOSE", "1", FALSE); } /* allow user to chose a local file */ diff --git a/plugins/tpm/fu-tpm-v2-device.c b/plugins/tpm/fu-tpm-v2-device.c index 9fb16b449..d8a4b65a3 100644 --- a/plugins/tpm/fu-tpm-v2-device.c +++ b/plugins/tpm/fu-tpm-v2-device.c @@ -249,7 +249,7 @@ fu_tpm_v2_device_setup(FuDevice *device, GError **error) /* suppress warning messages about missing TCTI libraries for tpm2-tss <2.3 */ if (g_getenv("FWUPD_UEFI_VERBOSE") == NULL) - g_setenv("TSS2_LOG", "esys+none,tcti+none", FALSE); + (void)g_setenv("TSS2_LOG", "esys+none,tcti+none", FALSE); /* setup TSS */ rc = Esys_Initialize(&ctx, NULL, NULL); diff --git a/plugins/uefi-capsule/fu-self-test.c b/plugins/uefi-capsule/fu-self-test.c index b307f9ddc..6f78de7a9 100644 --- a/plugins/uefi-capsule/fu-self-test.c +++ b/plugins/uefi-capsule/fu-self-test.c @@ -287,13 +287,13 @@ main(int argc, char **argv) g_test_init(&argc, &argv, NULL); testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); - g_setenv("FWUPD_SYSFSDRIVERDIR", testdatadir, TRUE); - g_setenv("FWUPD_UEFI_TEST", "1", TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSFSDRIVERDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_UEFI_TEST", "1", TRUE); /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/uefi/bgrt", fu_uefi_bgrt_func); diff --git a/plugins/uefi-capsule/fu-uefi-tool.c b/plugins/uefi-capsule/fu-uefi-tool.c index 1b85e8e44..4d5ad3b32 100644 --- a/plugins/uefi-capsule/fu-uefi-tool.c +++ b/plugins/uefi-capsule/fu-uefi-tool.c @@ -214,7 +214,7 @@ main(int argc, char *argv[]) /* set verbose? */ if (verbose) { - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", FALSE); } else { g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, fu_util_ignore_cb, NULL); } diff --git a/plugins/uefi-dbx/fu-dbxtool.c b/plugins/uefi-dbx/fu-dbxtool.c index 8594ea3e4..05506ae05 100644 --- a/plugins/uefi-dbx/fu-dbxtool.c +++ b/plugins/uefi-dbx/fu-dbxtool.c @@ -173,7 +173,7 @@ main(int argc, char *argv[]) /* set verbose? */ if (verbose) { - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", FALSE); } else { g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, fu_util_ignore_cb, NULL); } diff --git a/plugins/uefi-dbx/fu-self-test.c b/plugins/uefi-dbx/fu-self-test.c index 169053872..59ce11630 100644 --- a/plugins/uefi-dbx/fu-self-test.c +++ b/plugins/uefi-dbx/fu-self-test.c @@ -47,7 +47,7 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func("/uefi-dbx/image", fu_efi_image_func); diff --git a/plugins/wacom-usb/fu-self-test.c b/plugins/wacom-usb/fu-self-test.c index 1dacdc684..728a33c09 100644 --- a/plugins/wacom-usb/fu-self-test.c +++ b/plugins/wacom-usb/fu-self-test.c @@ -97,7 +97,7 @@ main(int argc, char **argv) g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); /* log everything */ - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", FALSE); /* tests go here */ g_test_add_func("/wac/firmware{parse}", fu_wac_firmware_parse_func); diff --git a/src/fu-config.c b/src/fu-config.c index 501c89071..0dd9ec0df 100644 --- a/src/fu-config.c +++ b/src/fu-config.c @@ -190,7 +190,7 @@ fu_config_reload(FuConfig *self, GError **error) /* get the domains to run in verbose */ domains = g_key_file_get_string(keyfile, "fwupd", "VerboseDomains", NULL); if (domains != NULL && domains[0] != '\0') - g_setenv("FWUPD_VERBOSE", domains, TRUE); + (void)g_setenv("FWUPD_VERBOSE", domains, TRUE); /* whether to update the motd on changes */ self->update_motd = diff --git a/src/fu-debug.c b/src/fu-debug.c index 11d820394..618877a94 100644 --- a/src/fu-debug.c +++ b/src/fu-debug.c @@ -196,10 +196,10 @@ fu_debug_post_parse_hook(GOptionContext *context, /* verbose? */ if (self->verbose) { - g_setenv("FWUPD_VERBOSE", "*", TRUE); + (void)g_setenv("FWUPD_VERBOSE", "*", TRUE); } else if (self->daemon_verbose != NULL) { g_autofree gchar *str = g_strjoinv(",", self->daemon_verbose); - g_setenv("FWUPD_VERBOSE", str, TRUE); + (void)g_setenv("FWUPD_VERBOSE", str, TRUE); } /* redirect all domains to be able to change FWUPD_VERBOSE at runtime */ @@ -219,7 +219,7 @@ fu_debug_post_parse_hook(GOptionContext *context, name_caps = g_ascii_strup(self->plugin_verbose[i], -1); varname = g_strdup_printf("FWUPD_%s_VERBOSE", name_caps); g_debug("setting %s=1", varname); - g_setenv(varname, "1", TRUE); + (void)g_setenv(varname, "1", TRUE); } } return TRUE; diff --git a/src/fu-self-test.c b/src/fu-self-test.c index bd0f7fc61..17eecc77d 100644 --- a/src/fu-self-test.c +++ b/src/fu-self-test.c @@ -1903,7 +1903,7 @@ fu_engine_history_func(gconstpointer user_data) g_assert_nonnull(component); /* set the counter */ - g_setenv("FWUPD_PLUGIN_TEST", "another-write-required", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "another-write-required", TRUE); fu_device_set_metadata_integer(device, "nr-update", 0); /* install it */ @@ -2126,7 +2126,7 @@ fu_engine_history_inherit(gconstpointer user_data) fu_engine_set_silo(engine, silo_empty); /* set up dummy plugin */ - g_setenv("FWUPD_PLUGIN_TEST", "fail", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "fail", TRUE); fu_engine_add_plugin(engine, self->plugin); ret = fu_engine_load(engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error); g_assert_no_error(error); @@ -2170,7 +2170,7 @@ fu_engine_history_inherit(gconstpointer user_data) g_assert_nonnull(component); /* install it */ - g_setenv("FWUPD_PLUGIN_TEST", "requires-activation", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "requires-activation", TRUE); fu_release_set_device(release, device); ret = fu_release_load(release, component, NULL, FWUPD_INSTALL_FLAG_NONE, &error); g_assert_no_error(error); @@ -2266,7 +2266,7 @@ fu_engine_install_needs_reboot(gconstpointer user_data) fu_engine_set_silo(engine, silo_empty); /* set up dummy plugin */ - g_setenv("FWUPD_PLUGIN_TEST", "fail", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "fail", TRUE); fu_engine_add_plugin(engine, self->plugin); ret = fu_engine_load(engine, FU_ENGINE_LOAD_FLAG_NONE, &error); g_assert_no_error(error); @@ -2310,7 +2310,7 @@ fu_engine_install_needs_reboot(gconstpointer user_data) g_assert_nonnull(component); /* install it */ - g_setenv("FWUPD_PLUGIN_TEST", "requires-reboot", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "requires-reboot", TRUE); fu_release_set_device(release, device); ret = fu_release_load(release, component, NULL, FWUPD_INSTALL_FLAG_NONE, &error); g_assert_no_error(error); @@ -2357,7 +2357,7 @@ fu_engine_history_error_func(gconstpointer user_data) fu_engine_set_silo(engine, silo_empty); /* set up dummy plugin */ - g_setenv("FWUPD_PLUGIN_TEST", "fail", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "fail", TRUE); fu_engine_add_plugin(engine, self->plugin); ret = fu_engine_load(engine, FU_ENGINE_LOAD_FLAG_NO_CACHE, &error); g_assert_no_error(error); @@ -3087,7 +3087,7 @@ fu_plugin_module_func(gconstpointer user_data) fu_engine_set_silo(engine, silo_empty); /* create a fake device */ - g_setenv("FWUPD_PLUGIN_TEST", "registration", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "registration", TRUE); ret = fu_plugin_runner_startup(self->plugin, &error); g_assert_no_error(error); g_assert_true(ret); @@ -3479,7 +3479,7 @@ fu_plugin_composite_func(gconstpointer user_data) g_assert_cmpint(components->len, ==, 3); /* set up dummy plugin */ - g_setenv("FWUPD_PLUGIN_TEST", "composite", TRUE); + (void)g_setenv("FWUPD_PLUGIN_TEST", "composite", TRUE); fu_engine_add_plugin(engine, self->plugin); ret = fu_plugin_runner_startup(self->plugin, &error); @@ -3846,16 +3846,16 @@ main(int argc, char **argv) /* only critical and error are fatal */ g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); - g_setenv("FWUPD_DEVICE_LIST_VERBOSE", "1", TRUE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv("FWUPD_DEVICE_LIST_VERBOSE", "1", TRUE); testdatadir = g_test_build_filename(G_TEST_DIST, "tests", NULL); - g_setenv("FWUPD_DATADIR", testdatadir, TRUE); - g_setenv("FWUPD_PLUGINDIR", testdatadir, TRUE); - g_setenv("FWUPD_SYSCONFDIR", testdatadir, TRUE); - g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); - g_setenv("CONFIGURATION_DIRECTORY", testdatadir, TRUE); - g_setenv("FWUPD_OFFLINE_TRIGGER", "/tmp/fwupd-self-test/system-update", TRUE); - g_setenv("FWUPD_LOCALSTATEDIR", "/tmp/fwupd-self-test/var", TRUE); + (void)g_setenv("FWUPD_DATADIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_PLUGINDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSCONFDIR", testdatadir, TRUE); + (void)g_setenv("FWUPD_SYSFSFWDIR", testdatadir, TRUE); + (void)g_setenv("CONFIGURATION_DIRECTORY", testdatadir, TRUE); + (void)g_setenv("FWUPD_OFFLINE_TRIGGER", "/tmp/fwupd-self-test/system-update", TRUE); + (void)g_setenv("FWUPD_LOCALSTATEDIR", "/tmp/fwupd-self-test/var", TRUE); /* ensure empty tree */ fu_self_test_mkroot(); diff --git a/src/fu-tool.c b/src/fu-tool.c index 8fc4f6e74..9d5330b14 100644 --- a/src/fu-tool.c +++ b/src/fu-tool.c @@ -3356,7 +3356,7 @@ main(int argc, char *argv[]) #ifdef _WIN32 /* workaround Windows setting the codepage to 1252 */ - g_setenv("LANG", "C.UTF-8", FALSE); + (void)g_setenv("LANG", "C.UTF-8", FALSE); #endif setlocale(LC_ALL, ""); @@ -3714,7 +3714,7 @@ main(int argc, char *argv[]) _("Ignoring SSL strict checks, " "to do this automatically in the future " "export DISABLE_SSL_STRICT in your environment")); - g_setenv("DISABLE_SSL_STRICT", "1", TRUE); + (void)g_setenv("DISABLE_SSL_STRICT", "1", TRUE); } /* parse filter flags */ diff --git a/src/fu-util.c b/src/fu-util.c index 8669e6617..8d8abf4fd 100644 --- a/src/fu-util.c +++ b/src/fu-util.c @@ -4301,7 +4301,7 @@ main(int argc, char *argv[]) _("Ignoring SSL strict checks, " "to do this automatically in the future " "export DISABLE_SSL_STRICT in your environment")); - g_setenv("DISABLE_SSL_STRICT", "1", TRUE); + (void)g_setenv("DISABLE_SSL_STRICT", "1", TRUE); } /* this doesn't have to be precise (e.g. using the build-year) as we just @@ -4347,8 +4347,8 @@ main(int argc, char *argv[]) /* set verbose? */ if (verbose) { - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); - g_setenv("FWUPD_VERBOSE", "1", FALSE); + (void)g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + (void)g_setenv("FWUPD_VERBOSE", "1", FALSE); } else { g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, fu_util_ignore_cb, NULL); }