diff options
| author | Michael Biebl <biebl@debian.org> | 2022-02-19 17:20:24 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-02-19 17:20:24 +0100 |
| commit | 7395026400b90013683a94e52692e22187024fff (patch) | |
| tree | 77924064bace3a47d5475791ad84e9fe8e87c9dc /src/libnm-core-impl/nm-keyfile-utils.c | |
| parent | a100b655aac1ea8feba6a27bdd7ab321e9a2aeb6 (diff) | |
| parent | e3f2ee969d065d2971170563c8aef77d5a0d39b9 (diff) | |
Update upstream source from tag 'upstream/1.35.92'
Update to upstream version '1.35.92' with Debian dir ea5f9880f6c04d63ab43dacd1d2ca9b7eb35c20c
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); +} |