summary refs log tree commit diff
path: root/src/core/nm-config.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2025-09-12 19:47:07 +0200
committerMichael Biebl <biebl@debian.org>2025-09-12 19:47:07 +0200
commitbc5f10851bffd6af1c2855635be7a28b6dba3195 (patch)
treed47255895378efcdc0a32c2ddeed055f76935654 /src/core/nm-config.c
parent7e9091a5960f67a84787c03153324915220e4816 (diff)
New upstream version 1.54.1 upstream/1.54.1
Diffstat (limited to 'src/core/nm-config.c')
-rw-r--r--src/core/nm-config.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/nm-config.c b/src/core/nm-config.c
index a55d2d13..d1f2bbed 100644
--- a/src/core/nm-config.c
+++ b/src/core/nm-config.c
@@ -18,6 +18,7 @@
 #include "libnm-core-intern/nm-core-internal.h"
 #include "libnm-core-intern/nm-keyfile-internal.h"
 #include "libnm-core-intern/nm-keyfile-utils.h"
+#include "libnm-glib-aux/nm-keyfile-aux.h"
 
 #define DEFAULT_CONFIG_MAIN_FILE     NMCONFDIR "/NetworkManager.conf"
 #define DEFAULT_CONFIG_DIR           NMCONFDIR "/conf.d"
@@ -1046,6 +1047,10 @@ read_config(GKeyFile   *keyfile,
             /* internal groups cannot be set by user configuration. */
             continue;
         }
+
+        if (!g_key_file_has_group(keyfile, group))
+            nm_key_file_add_group(keyfile, group);
+
         keys = g_key_file_get_keys(kf, group, &nkeys, NULL);
         if (!keys)
             continue;
@@ -1639,6 +1644,12 @@ intern_config_read(const char        *filename,
                                  "");
         }
 
+        if (!g_key_file_has_group(keyfile_intern, group)) {
+            nm_key_file_add_group(keyfile_intern, group);
+            if (is_intern)
+                has_intern = TRUE;
+        }
+
         for (k = 0; keys[k]; k++) {
             gs_free char *value_set = NULL;
             const char   *key       = keys[k];
@@ -1823,6 +1834,9 @@ intern_config_write(const char        *filename,
             }
         }
 
+        if (!g_key_file_has_group(keyfile, group))
+            nm_key_file_add_group(keyfile, group);
+
         for (k = 0; keys[k]; k++) {
             const char   *key       = keys[k];
             gs_free char *value_set = NULL;