From 7e713cf65aaf42af3bc9ae0457675766a08e1df0 Mon Sep 17 00:00:00 2001 From: Dhanuka Warusadura Date: Wed, 31 Mar 2021 13:02:32 +0530 Subject: [PATCH 1/2] Fix issues flagged by static analyzers These changes specifically fix the issues flagged by clang-analyzer. Fixes: #59 --- libsecret/secret-collection.c | 2 -- libsecret/secret-service.c | 6 ------ libsecret/test-methods.c | 5 +++++ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libsecret/secret-collection.c b/libsecret/secret-collection.c index 4e27422..5e3378d 100644 --- a/libsecret/secret-collection.c +++ b/libsecret/secret-collection.c @@ -1560,8 +1560,6 @@ secret_collection_search_sync (SecretCollection *self, if (paths == NULL) return NULL; - ret = TRUE; - want = 1; if (flags & SECRET_SEARCH_ALL) want = G_MAXINT; diff --git a/libsecret/secret-service.c b/libsecret/secret-service.c index c2abbc2..455248c 100644 --- a/libsecret/secret-service.c +++ b/libsecret/secret-service.c @@ -1140,9 +1140,6 @@ secret_service_open (GType service_gtype, g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); g_return_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE)); - if (service_bus_name == NULL) - service_bus_name = get_default_bus_name (); - g_async_initable_new_async (service_gtype, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, @@ -1217,9 +1214,6 @@ secret_service_open_sync (GType service_gtype, g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); g_return_val_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE), NULL); - if (service_bus_name == NULL) - service_bus_name = get_default_bus_name (); - return g_initable_new (service_gtype, cancellable, error, "flags", flags, NULL); diff --git a/libsecret/test-methods.c b/libsecret/test-methods.c index a1cc595..121ebd5 100644 --- a/libsecret/test-methods.c +++ b/libsecret/test-methods.c @@ -727,6 +727,7 @@ test_store_sync (Test *test, ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path, "New Item Label", value, NULL, &error); + g_assert_true (ret); g_assert_no_error (error); secret_value_unref (value); g_hash_table_unref (attributes); @@ -776,10 +777,12 @@ test_store_replace (Test *test, ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path, "New Item Label", value, NULL, &error); + g_assert_true (ret); g_assert_no_error (error); ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path, "Another Label", value, NULL, &error); + g_assert_true (ret); g_assert_no_error (error); secret_value_unref (value); g_hash_table_unref (attributes); @@ -829,6 +832,7 @@ test_store_async (Test *test, egg_test_wait (); ret = secret_service_store_finish (test->service, result, &error); + g_assert_true (ret); g_assert_no_error (error); g_object_unref (result); @@ -877,6 +881,7 @@ test_store_no_default (Test *test, ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, SECRET_COLLECTION_DEFAULT, "New Item Label", value, NULL, &error); + g_assert_true (ret); g_assert_no_error (error); secret_value_unref (value); g_hash_table_unref (attributes); From 06931ac755b6095bca4558eb798ab87ebd5be394 Mon Sep 17 00:00:00 2001 From: Dhanuka Warusadura Date: Wed, 31 Mar 2021 15:01:09 +0530 Subject: [PATCH 2/2] Fixes a typo Argument to g_print should be part not path. --- tool/secret-tool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/secret-tool.c b/tool/secret-tool.c index f5508fd..5d95194 100644 --- a/tool/secret-tool.c +++ b/tool/secret-tool.c @@ -380,7 +380,7 @@ on_retrieve_secret (GObject *source_object, part = strrchr (path, '/'); if (part == NULL) part = path; - g_print ("[%s]\n", path); + g_print ("[%s]\n", part); } else { g_print ("[no path]\n"); }