diff options
| author | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-02-22 16:55:11 -0500 |
|---|---|---|
| committer | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-02-22 17:04:04 -0500 |
| commit | 9bb70a1702d95481541916bd29903a8d75251831 (patch) | |
| tree | 5af847e78e5836ffd841714b541636729675d6a6 /src/libnm-core-impl/nm-keyfile-utils.c | |
| parent | 2ddef01c8fe66feabcd5a33b904ff3a5deb89652 (diff) | |
| parent | 6dff5938b0e45d461d0351da304a68916f2e9a2b (diff) | |
Merge tag 'debian/1.35.92-1' into ubuntu/master
network-manager Debian release 1.35.92-1
Diffstat (limited to 'src/libnm-core-impl/nm-keyfile-utils.c')
| -rw-r--r-- | src/libnm-core-impl/nm-keyfile-utils.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libnm-core-impl/nm-keyfile-utils.c b/src/libnm-core-impl/nm-keyfile-utils.c index 0e2e2d45..c599aefa 100644 --- a/src/libnm-core-impl/nm-keyfile-utils.c +++ b/src/libnm-core-impl/nm-keyfile-utils.c @@ -682,3 +682,22 @@ nm_keyfile_key_decode(const char *key, char **out_to_free) #endif return name; } + +void +nm_keyfile_add_group(GKeyFile *keyfile, const char *group) +{ + nm_assert(keyfile); + nm_assert(group); + + /* You can only call this function if the group doesn't exist yet. + * Because, we are about to add a dummy key, so we would have to + * be sure that the key doesn't exist. */ + nm_assert(!g_key_file_has_group(keyfile, group)); + + /* Ensure the group is present. + * There is no API for that, so add and remove a dummy key. + * For a profile it matters whether a setting is present or not, + * and we need to ensure that we persist the presence of the setting to keyfile*/ + g_key_file_set_value(keyfile, group, ".X", "1"); + g_key_file_remove_key(keyfile, group, ".X", NULL); +} |