diff options
author | Antonio Cardace <acardace@redhat.com> | 2020-05-07 17:09:49 +0200 |
---|---|---|
committer | Antonio Cardace <acardace@redhat.com> | 2020-05-13 10:15:23 +0200 |
commit | 858fb211ad11bd9a7e89f63fe62d4fa7f8cee7b1 (patch) | |
tree | 929caf2db0e1ce1b2b815ccfce793e2f56a2dfd1 | |
parent | cf25497569d9b5e03337bced806bd4cbd97b2eda (diff) | |
download | NetworkManager-858fb211ad11bd9a7e89f63fe62d4fa7f8cee7b1.tar.gz |
keyfile: add support for uint32 variant types when using gendata
https://bugzilla.redhat.com/show_bug.cgi?id=1614700
-rw-r--r-- | shared/nm-keyfile/nm-keyfile.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shared/nm-keyfile/nm-keyfile.c b/shared/nm-keyfile/nm-keyfile.c index 0caef893e0..372ae202e3 100644 --- a/shared/nm-keyfile/nm-keyfile.c +++ b/shared/nm-keyfile/nm-keyfile.c @@ -3243,6 +3243,22 @@ _read_setting (KeyfileReaderInfo *info) continue; } variant = g_variant_new_boolean (v); + } else if (g_variant_type_equal (variant_type, G_VARIANT_TYPE_UINT32)) { + guint64 v; + + v = g_key_file_get_uint64 (info->keyfile, + info->group, + key, + &local); + + if (local) { + if (!handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN, + _("key '%s.%s' is not a uint32"), + info->group, key)) + break; + continue; + } + variant = g_variant_new_uint32 ((guint32) v); } else { nm_assert_not_reached (); continue; @@ -3851,6 +3867,11 @@ nm_keyfile_write (NMConnection *connection, setting_name, key, g_variant_get_boolean (v)); + } else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT32)) { + g_key_file_set_uint64 (info.keyfile, + setting_name, + key, + (guint64) g_variant_get_uint32 (v)); } else { /* BUG: The variant type is not implemented. Since the connection * verifies, this can only mean we either wrongly didn't reject |