summaryrefslogtreecommitdiff
path: root/libnm-util/nm-setting.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-12-09 11:20:35 +0100
committerThomas Haller <thaller@redhat.com>2013-12-09 11:26:33 +0100
commit1c031cddf7daa2b5328b2fc80c1d4d1e4063e82b (patch)
tree66e2a3d780d323bdfc41a93b4b6318b69ca724f9 /libnm-util/nm-setting.c
parent597c1c7a9a8448c4e6adc435b0e31609b0cb3e85 (diff)
downloadNetworkManager-1c031cddf7daa2b5328b2fc80c1d4d1e4063e82b.tar.gz
libnm-util: bugfix wrong diff result in nm_connection_diff
Commit 6abc7b78f68e2e815bf8a8cec2a3235e35bb07e4 introduced a bug in nm_connection_diff() by not reading the property value with g_object_get_property(). Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'libnm-util/nm-setting.c')
-rw-r--r--libnm-util/nm-setting.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c
index a0e287339b..bd06b90090 100644
--- a/libnm-util/nm-setting.c
+++ b/libnm-util/nm-setting.c
@@ -688,7 +688,6 @@ nm_setting_diff (NMSetting *a,
for (i = 0; i < n_property_specs; i++) {
GParamSpec *prop_spec = property_specs[i];
- GValue a_value = G_VALUE_INIT, b_value = G_VALUE_INIT;
NMSettingDiffResult r = NM_SETTING_DIFF_RESULT_UNKNOWN, tmp;
gboolean different = TRUE;
@@ -701,16 +700,19 @@ nm_setting_diff (NMSetting *a,
if (b) {
different = !NM_SETTING_GET_CLASS (a)->compare_property (a, b, prop_spec, flags);
if (different) {
- g_value_init (&a_value, prop_spec->value_type);
- g_value_init (&b_value, prop_spec->value_type);
+ GValue value = G_VALUE_INIT;
- if (!g_param_value_defaults (prop_spec, &a_value))
+ g_value_init (&value, prop_spec->value_type);
+ g_object_get_property (G_OBJECT (a), prop_spec->name, &value);
+ if (!g_param_value_defaults (prop_spec, &value))
r |= a_result;
- if (!g_param_value_defaults (prop_spec, &b_value))
+
+ g_value_reset (&value);
+ g_object_get_property (G_OBJECT (b), prop_spec->name, &value);
+ if (!g_param_value_defaults (prop_spec, &value))
r |= b_result;
- g_value_unset (&a_value);
- g_value_unset (&b_value);
+ g_value_unset (&value);
}
} else
r = a_result; /* only in A */