From 6235bc1a2c5bdcb995760db63f2da61665182ac9 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 13 Apr 2022 14:47:06 +0100 Subject: trivial: Be explicit when ignoring return error values --- client/as-builder.c | 2 +- client/as-compose.c | 2 +- client/as-util.c | 2 +- libappstream-builder/asb-context.c | 3 ++- libappstream-builder/asb-self-test.c | 4 ++-- libappstream-glib/as-app.c | 2 +- libappstream-glib/as-self-test.c | 30 +++++++++++++++--------------- 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/client/as-builder.c b/client/as-builder.c index baf81cb..60464bb 100644 --- a/client/as-builder.c +++ b/client/as-builder.c @@ -144,7 +144,7 @@ main (int argc, char **argv) } if (verbose) - g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); /* set defaults */ if (temp_dir == NULL) diff --git a/client/as-compose.c b/client/as-compose.c index a1104c4..6ad2564 100644 --- a/client/as-compose.c +++ b/client/as-compose.c @@ -360,7 +360,7 @@ main (int argc, char **argv) } if (verbose) - g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); /* set defaults */ if (prefix == NULL) diff --git a/client/as-util.c b/client/as-util.c index 21621c4..7ce9e1e 100644 --- a/client/as-util.c +++ b/client/as-util.c @@ -4720,7 +4720,7 @@ main (int argc, char *argv[]) /* set verbose? */ if (verbose) { priv->verbose = TRUE; - 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, as_util_ignore_cb, NULL); diff --git a/libappstream-builder/asb-context.c b/libappstream-builder/asb-context.c index e2b83df..0bf6e32 100644 --- a/libappstream-builder/asb-context.c +++ b/libappstream-builder/asb-context.c @@ -1053,7 +1053,8 @@ asb_context_process (AsbContext *ctx, GError **error) "%s is not enabled", asb_package_get_nevr (pkg)); asb_context_add_app_ignore (ctx, pkg); - asb_package_log_flush (pkg, NULL); + if (!asb_package_log_flush (pkg, error)) + return FALSE; continue; } diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c index 8dc6370..dbc21b9 100644 --- a/libappstream-builder/asb-self-test.c +++ b/libappstream-builder/asb-self-test.c @@ -639,8 +639,8 @@ 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 ("ASB_IS_SELF_TEST", "", TRUE); - g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); + (void)g_setenv ("ASB_IS_SELF_TEST", "", TRUE); + (void)g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); /* tests go here */ g_test_add_func ("/AppStreamBuilder/package", asb_test_package_func); diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 76c0727..ae75973 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -2663,7 +2663,7 @@ as_app_set_update_contact (AsApp *app, const gchar *update_contact) replacements[i].search); if (tmp != NULL) { *tmp = replacements[i].replace; - g_strlcpy (tmp + 1, + (void)g_strlcpy (tmp + 1, tmp + strlen (replacements[i].search), len); done_replacement = TRUE; diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c index efcaa1f..11b51b6 100644 --- a/libappstream-glib/as-self-test.c +++ b/libappstream-glib/as-self-test.c @@ -163,8 +163,8 @@ as_test_monitor_dir_func (void) tmpfile = g_build_filename (tmpdir, "test.txt", NULL); tmpfile_new = g_build_filename (tmpdir, "newtest.txt", NULL); - g_unlink (tmpfile); - g_unlink (tmpfile_new); + (void)g_unlink (tmpfile); + (void)g_unlink (tmpfile_new); mon = as_monitor_new (); g_signal_connect (mon, "added", @@ -180,7 +180,7 @@ as_test_monitor_dir_func (void) g_assert (ret); /* create directory */ - g_mkdir_with_parents (tmpdir, 0700); + (void)g_mkdir_with_parents (tmpdir, 0700); /* touch file */ cmd_touch = g_strdup_printf ("touch %s", tmpfile); @@ -206,7 +206,7 @@ as_test_monitor_dir_func (void) /* delete it */ cnt_added = cnt_removed = cnt_changed = 0; - g_unlink (tmpfile); + (void)g_unlink (tmpfile); as_test_loop_run_with_timeout (2000); as_test_loop_quit (); g_assert_cmpint (cnt_added, ==, 0); @@ -244,8 +244,8 @@ as_test_monitor_dir_func (void) g_assert_cmpint (cnt_removed, ==, 1); g_assert_cmpint (cnt_changed, ==, 0); - g_unlink (tmpfile); - g_unlink (tmpfile_new); + (void)g_unlink (tmpfile); + (void)g_unlink (tmpfile_new); } static void @@ -261,8 +261,8 @@ as_test_monitor_file_func (void) const gchar *tmpfile_new = "/tmp/two.txt"; g_autofree gchar *cmd_touch = NULL; - g_unlink (tmpfile); - g_unlink (tmpfile_new); + (void)g_unlink (tmpfile); + (void)g_unlink (tmpfile_new); mon = as_monitor_new (); g_signal_connect (mon, "added", @@ -302,7 +302,7 @@ as_test_monitor_file_func (void) /* delete it */ cnt_added = cnt_removed = cnt_changed = 0; - g_unlink (tmpfile); + (void)g_unlink (tmpfile); as_test_loop_run_with_timeout (2000); as_test_loop_quit (); g_assert_cmpint (cnt_added, ==, 0); @@ -2517,7 +2517,7 @@ as_test_store_local_appdata_func (void) /* open test store */ #ifdef _WIN32 - g_setenv ("XDG_DATA_DIRS", "/usr/share/", TRUE); + (void)g_setenv ("XDG_DATA_DIRS", "/usr/share/", TRUE); #endif store = as_store_new (); filename = as_test_get_filename ("."); @@ -3470,8 +3470,8 @@ as_test_store_auto_reload_dir_func (void) AS_STORE_WATCH_FLAG_REMOVED); as_store_set_destdir (store, "/tmp/repo-tmp"); - g_mkdir_with_parents ("/tmp/repo-tmp/usr/share/app-info/xmls", 0700); - g_unlink ("/tmp/repo-tmp/usr/share/app-info/xmls/foo.xml"); + (void)g_mkdir_with_parents ("/tmp/repo-tmp/usr/share/app-info/xmls", 0700); + (void)g_unlink ("/tmp/repo-tmp/usr/share/app-info/xmls/foo.xml"); /* load store */ ret = as_store_load (store, AS_STORE_LOAD_FLAG_APP_INFO_SYSTEM, NULL, &error); @@ -3502,7 +3502,7 @@ as_test_store_auto_reload_dir_func (void) g_assert (app != NULL); /* remove file */ - g_unlink ("/tmp/repo-tmp/usr/share/app-info/xmls/foo.xml"); + (void)g_unlink ("/tmp/repo-tmp/usr/share/app-info/xmls/foo.xml"); as_test_loop_run_with_timeout (2000); g_assert_cmpint (cnt, ==, 3); g_assert_cmpint (cnt_added, ==, 1); @@ -3597,7 +3597,7 @@ as_test_store_auto_reload_file_func (void) g_assert_cmpstr (as_release_get_version (rel), ==, "0.1.0"); /* remove file */ - g_unlink ("/tmp/foo.xml"); + (void)g_unlink ("/tmp/foo.xml"); as_test_loop_run_with_timeout (2000); g_assert_cmpint (cnt, ==, 3); app = as_store_get_app_by_id (store, "baz.desktop"); @@ -3698,7 +3698,7 @@ as_test_store_flatpak_func (void) g_autoptr(GPtrArray) apps = NULL; /* make throws us under a bus, yet again */ - g_setenv ("AS_SELF_TEST_PREFIX_DELIM", "_", TRUE); + (void)g_setenv ("AS_SELF_TEST_PREFIX_DELIM", "_", TRUE); /* load a symlinked file to the store */ store = as_store_new (); -- cgit v1.2.1