From e950712c256bb353df1b8ac6e7e414625bf87ad5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 10 Jan 2019 19:38:36 +0100 Subject: libnm,core: accept failure to _nm_setting_get_property() in _log_connection_get_property() _log_connection_get_property() is a hack, as it cannot meaningfully print complex properties. Also, it uses _nm_setting_get_property() which can only work with GObject base properties. Don't assert against _nm_setting_get_property() returning success. Eventually we should replace _nm_setting_get_property() by something better. But for the moment, it's fine to being unable to print a property value. --- libnm-core/nm-setting.c | 9 +++++---- src/nm-core-utils.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index cfd95a2d3e..0feaa87fb7 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -1016,7 +1016,7 @@ gboolean _nm_setting_get_property (NMSetting *setting, const char *property_name, GValue *value) { const NMSettInfoSetting *sett_info; - GParamSpec *prop_spec; + const NMSettInfoProperty *property_info; g_return_val_if_fail (NM_IS_SETTING (setting), FALSE); g_return_val_if_fail (property_name, FALSE); @@ -1040,13 +1040,14 @@ _nm_setting_get_property (NMSetting *setting, const char *property_name, GValue return TRUE; } - prop_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_name); - if (!prop_spec) { + property_info = _nm_sett_info_setting_get_property_info (sett_info, property_name); + if ( !property_info + || !property_info->param_spec) { g_value_unset (value); return FALSE; } - g_value_init (value, prop_spec->value_type); + g_value_init (value, property_info->param_spec->value_type); g_object_get_property (G_OBJECT (setting), property_name, value); return TRUE; } diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 89f8f329f8..3047ebc846 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -2033,7 +2033,7 @@ _log_connection_get_property (NMSetting *setting, const char *name) return g_strdup ("****"); if (!_nm_setting_get_property (setting, name, &val)) - g_return_val_if_reached (FALSE); + return g_strdup (""); if (G_VALUE_HOLDS_STRING (&val)) { const char *val_s; -- cgit v1.2.1