From 13e7ae907de35f364f9e2573175124aa0691c840 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 25 Jul 2023 11:17:36 -0400 Subject: [PATCH] tree-wide: Consistently `(void)g_variant_lookup()` Coverity warns when we're checking the return value in most-but-not-all instances. The code is correct in these instances; we're initializing the values to defaults. So add a `(void)` cast like we are doing in many other places. --- src/libostree/ostree-repo-pull.c | 9 +++++---- src/libostree/ostree-repo.c | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 2ad9215aa2..517c426fac 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -3548,8 +3548,9 @@ ostree_repo_pull_with_options (OstreeRepo *self, const char *remote_name_or_base opt_gpg_verify_set = g_variant_lookup (options, "gpg-verify", "b", &pull_data->gpg_verify); opt_gpg_verify_summary_set = g_variant_lookup (options, "gpg-verify-summary", "b", &pull_data->gpg_verify_summary); - g_variant_lookup (options, "disable-sign-verify", "b", &disable_sign_verify); - g_variant_lookup (options, "disable-sign-verify-summary", "b", &disable_sign_verify_summary); + (void)g_variant_lookup (options, "disable-sign-verify", "b", &disable_sign_verify); + (void)g_variant_lookup (options, "disable-sign-verify-summary", "b", + &disable_sign_verify_summary); (void)g_variant_lookup (options, "depth", "i", &pull_data->maxdepth); (void)g_variant_lookup (options, "disable-static-deltas", "b", &pull_data->disable_static_deltas); @@ -4415,8 +4416,8 @@ ostree_repo_pull_with_options (OstreeRepo *self, const char *remote_name_or_base if (!collect_available_deltas_for_pull (pull_data, deltas, error)) goto out; - g_variant_lookup (additional_metadata, OSTREE_SUMMARY_INDEXED_DELTAS, "b", - &pull_data->has_indexed_deltas); + (void)g_variant_lookup (additional_metadata, OSTREE_SUMMARY_INDEXED_DELTAS, "b", + &pull_data->has_indexed_deltas); } if (pull_data->summary diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 46d2c12c6b..36c1e6de01 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -2637,7 +2637,7 @@ repo_create_at_internal (int dfd, const char *path, OstreeRepoMode mode, GVarian const char *collection_id = NULL; if (options) - g_variant_lookup (options, "collection-id", "&s", &collection_id); + (void)g_variant_lookup (options, "collection-id", "&s", &collection_id); if (collection_id != NULL) g_string_append_printf (config_data, "collection-id=%s\n", collection_id); @@ -5806,10 +5806,10 @@ regenerate_metadata (OstreeRepo *self, gboolean do_metadata_commit, GVariant *ad return glnx_throw (error, "Invalid options doesn't match variant type '%s'", (const char *)G_VARIANT_TYPE_VARDICT); - g_variant_lookup (options, "gpg-key-ids", "^a&s", &gpg_key_ids); - g_variant_lookup (options, "gpg-homedir", "&s", &gpg_homedir); + (void)g_variant_lookup (options, "gpg-key-ids", "^a&s", &gpg_key_ids); + (void)g_variant_lookup (options, "gpg-homedir", "&s", &gpg_homedir); sign_keys = g_variant_lookup_value (options, "sign-keys", G_VARIANT_TYPE_ARRAY); - g_variant_lookup (options, "sign-type", "&s", &sign_type); + (void)g_variant_lookup (options, "sign-type", "&s", &sign_type); if (sign_keys != NULL) {