diff options
Diffstat (limited to 'src/software-dbus/LMI_SoftwareIdentityResourceProvider.c')
-rw-r--r-- | src/software-dbus/LMI_SoftwareIdentityResourceProvider.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/software-dbus/LMI_SoftwareIdentityResourceProvider.c b/src/software-dbus/LMI_SoftwareIdentityResourceProvider.c index 4c77bf5..18d3946 100644 --- a/src/software-dbus/LMI_SoftwareIdentityResourceProvider.c +++ b/src/software-dbus/LMI_SoftwareIdentityResourceProvider.c @@ -22,8 +22,6 @@ #include "LMI_SoftwareIdentityResource.h" #include "sw-utils.h" -#define DSC_LEN 256 - static const CMPIBroker* _cb = NULL; static void LMI_SoftwareIdentityResourceInitialize(const CMPIContext *ctx) @@ -60,10 +58,10 @@ static CMPIStatus LMI_SoftwareIdentityResourceEnumInstances( gboolean repo_enabled; gchar *repo_id = NULL, *repo_desc = NULL; unsigned i; - char error_msg[ERROR_MSG_LEN] = "", dsc[DSC_LEN] = "", - instance_id[INSTANCE_ID_LEN] = ""; + char error_msg[BUFLEN] = "", dsc[BUFLEN] = "", + instance_id[BUFLEN] = ""; - get_pk_repos(&array, error_msg, ERROR_MSG_LEN); + get_pk_repos(&array, error_msg, BUFLEN); if (!array) { goto done; } @@ -71,15 +69,15 @@ static CMPIStatus LMI_SoftwareIdentityResourceEnumInstances( for (i = 0; i < array->len; i++) { g_object_get(g_ptr_array_index(array, i), "repo-id", &repo_id, "description", &repo_desc, "enabled", &repo_enabled, NULL); - snprintf(dsc, DSC_LEN, "[%s] - %s", repo_id, repo_desc); - create_instance_id(SW_IDENTITY_RESOURCE_CLASS_NAME, repo_id, - instance_id, INSTANCE_ID_LEN); + snprintf(dsc, BUFLEN, "[%s] - %s", repo_id, repo_desc); + create_instance_id(LMI_SoftwareIdentityResource_ClassName, repo_id, + instance_id, BUFLEN); LMI_SoftwareIdentityResource w; LMI_SoftwareIdentityResource_Init(&w, _cb, KNameSpace(cop)); LMI_SoftwareIdentityResource_Set_SystemName(&w, lmi_get_system_name()); LMI_SoftwareIdentityResource_Set_CreationClassName(&w, - ORGID "_" SW_IDENTITY_RESOURCE_CLASS_NAME); + LMI_SoftwareIdentityResource_ClassName); LMI_SoftwareIdentityResource_Set_SystemCreationClassName(&w, lmi_get_system_creation_class_name()); LMI_SoftwareIdentityResource_Set_Name(&w, repo_id); @@ -124,18 +122,17 @@ static CMPIStatus LMI_SoftwareIdentityResourceEnumInstances( } KReturnInstance(cr, w); + + g_free(repo_id); + repo_id = NULL; + g_free(repo_desc); + repo_desc = NULL; } done: if (array) { g_ptr_array_unref(array); } - if (repo_id) { - g_free(repo_id); - } - if (repo_desc) { - g_free(repo_desc); - } if (*error_msg) { KReturn2(_cb, ERR_FAILED, "%s", error_msg); @@ -244,7 +241,7 @@ KUint32 LMI_SoftwareIdentityResource_RequestStateChange( PkResults *results = NULL; GError *gerror = NULL; gboolean enable; - char error_msg[ERROR_MSG_LEN] = ""; + char error_msg[BUFLEN] = ""; unsigned ret = 1; if (RequestedState->null || !RequestedState->exists) { @@ -276,7 +273,7 @@ KUint32 LMI_SoftwareIdentityResource_RequestStateChange( results = pk_task_repo_enable_sync(task, self->Name.chars, enable, NULL, NULL, NULL, &gerror); if (check_and_create_error_msg(results, gerror, - "Failed to set repository state", error_msg, ERROR_MSG_LEN)) { + "Failed to set repository state", error_msg, BUFLEN)) { goto done; } |