mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 19:30:37 +01:00
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.
This commit is contained in:
parent
d2f0e16ccd
commit
3846976eb6
2 changed files with 6 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ("<unknown>");
|
||||
|
||||
if (G_VALUE_HOLDS_STRING (&val)) {
|
||||
const char *val_s;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue