summaryrefslogtreecommitdiffstats
path: root/src/software-dbus/LMI_SoftwareIdentityProvider.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/software-dbus/LMI_SoftwareIdentityProvider.c')
-rw-r--r--src/software-dbus/LMI_SoftwareIdentityProvider.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/src/software-dbus/LMI_SoftwareIdentityProvider.c b/src/software-dbus/LMI_SoftwareIdentityProvider.c
index 73a8ae5..09fbd93 100644
--- a/src/software-dbus/LMI_SoftwareIdentityProvider.c
+++ b/src/software-dbus/LMI_SoftwareIdentityProvider.c
@@ -45,6 +45,7 @@ static CMPIStatus LMI_SoftwareIdentityEnumInstanceNames(
{
PkTask *task = NULL;
PkResults *results = NULL;
+ GError *gerror = NULL;
GPtrArray *array = NULL;
SwPackage sw_pkg;
unsigned i;
@@ -55,9 +56,9 @@ static CMPIStatus LMI_SoftwareIdentityEnumInstanceNames(
task = pk_task_new();
- results = pk_task_get_packages_sync(task, 0, NULL, NULL, NULL, NULL);
- if (check_and_create_error_msg(results, "Getting list of packages failed",
- error_msg, ERROR_MSG_LEN)) {
+ results = pk_task_get_packages_sync(task, 0, NULL, NULL, NULL, &gerror);
+ if (check_and_create_error_msg(results, gerror,
+ "Getting list of packages failed", error_msg, ERROR_MSG_LEN)) {
goto done;
}
@@ -82,6 +83,8 @@ static CMPIStatus LMI_SoftwareIdentityEnumInstanceNames(
}
done:
+ g_clear_error(&gerror);
+
if (task) {
g_object_unref(task);
}
@@ -120,6 +123,7 @@ static CMPIStatus LMI_SoftwareIdentityGetInstance(
PkPackage *pk_pkg = NULL;
PkDetails *pk_det = NULL;
PkResults *results = NULL, *results2 = NULL;
+ GError *gerror = NULL;
GPtrArray *array = NULL;
gchar **values = NULL;
SwPackage sw_pkg;
@@ -147,8 +151,8 @@ static CMPIStatus LMI_SoftwareIdentityGetInstance(
values[0] = g_strdup(sw_pkg.name);
values[1] = NULL;
- results = pk_task_resolve_sync(task, 0, values, NULL, NULL, NULL, NULL);
- if (check_and_create_error_msg(results, "Resolving package failed",
+ results = pk_task_resolve_sync(task, 0, values, NULL, NULL, NULL, &gerror);
+ if (check_and_create_error_msg(results, gerror, "Resolving package failed",
error_msg, ERROR_MSG_LEN)) {
goto done;
}
@@ -189,21 +193,24 @@ static CMPIStatus LMI_SoftwareIdentityGetInstance(
g_free(values[0]);
values[0] = g_strdup(pk_package_get_id(pk_pkg));
- results2 = pk_task_get_details_sync(task, values, NULL, NULL, NULL, NULL);
- if (check_and_create_error_msg(results2, "Getting package details failed",
- error_msg, ERROR_MSG_LEN)) {
- goto done;
- }
-
- g_ptr_array_unref(array);
- array = pk_results_get_details_array(results2);
- for (j = 0; j < array->len; j++) {
- pk_det = g_ptr_array_index(array, j);
- if (strcmp(pk_details_get_package_id(pk_det),
- pk_package_get_id(pk_pkg)) == 0) {
- LMI_SoftwareIdentity_Set_Description(&w,
- pk_details_get_description(pk_det));
- break;
+ results2 = pk_task_get_details_sync(task, values, NULL, NULL, NULL,
+ &gerror);
+ if (check_and_create_error_msg(results2, gerror,
+ "Getting package details failed", error_msg, ERROR_MSG_LEN)) {
+ warn(error_msg);
+ /* This is non-fatal problem. */
+ error_msg[0] = '\0';
+ } else {
+ g_ptr_array_unref(array);
+ array = pk_results_get_details_array(results2);
+ for (j = 0; j < array->len; j++) {
+ pk_det = g_ptr_array_index(array, j);
+ if (strcmp(pk_details_get_package_id(pk_det),
+ pk_package_get_id(pk_pkg)) == 0) {
+ LMI_SoftwareIdentity_Set_Description(&w,
+ pk_details_get_description(pk_det));
+ break;
+ }
}
}
@@ -213,6 +220,7 @@ done:
free_sw_package(&sw_pkg);
g_strfreev(values);
+ g_clear_error(&gerror);
if (task) {
g_object_unref(task);