From 71f1d61215fb28a62eb9352fb09bfb23b274ce5e Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 13 Jul 2016 14:21:11 +0200 Subject: [PATCH] [Systeminfo] Return partial results for STORAGE if dbus fail [Feature] If dbus call failed, results was empty. Now returned array will hold as much data as it is possible, internal storage information would be returned. DBUS fails would be silent. [Verification] Code compiles without errors. TCT passrate is 100%. Change-Id: I65a98a95ab69416af5c61737eb93f98a7d7c3625 Signed-off-by: Piotr Kosko --- .../filesystem/filesystem_provider_deviced.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/common/filesystem/filesystem_provider_deviced.cc b/src/common/filesystem/filesystem_provider_deviced.cc index 81bb5705..3c22667d 100644 --- a/src/common/filesystem/filesystem_provider_deviced.cc +++ b/src/common/filesystem/filesystem_provider_deviced.cc @@ -231,6 +231,11 @@ Storages FilesystemProviderDeviced::GetStorages() { return Storages(); } + // internal storages are gathered with storage api + Storages internal = virtual_roots_provider_.GetStorages(); + + // external storages are gathered using deviced implementation + Storages result; GError* error = nullptr; GVariant* variant = g_dbus_connection_call_sync(dbus_, kBus, @@ -246,12 +251,10 @@ Storages FilesystemProviderDeviced::GetStorages() { if (!variant || error) { std::string message = error ? error->message : ""; LoggerE("Failed to call GetDeviceList method - %s", message.c_str()); - return Storages(); + } else { + LoggerD("GetDeviceList succeed - handling result"); + result = GetStoragesFromGVariant(variant); } - // internal storages are gathered with storage api - Storages internal = virtual_roots_provider_.GetStorages(); - // external storages are gathered using deviced implementation - Storages result = GetStoragesFromGVariant(variant); // merging internal and external results together, but internal on the beginning result.insert(result.begin(), internal.begin(), internal.end()); -- 2.34.1