summaryrefslogtreecommitdiff
path: root/src/initrd
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-10-19 11:55:02 +0200
committerThomas Haller <thaller@redhat.com>2018-10-19 11:55:06 +0200
commit4ca7fa7f4abfd52e13844013cffa0dbda3146f9a (patch)
tree71b23b4209d4d1ff10c73b03fef3349313931c12 /src/initrd
parent39bd412d289428574543d36281b668d5e3fed214 (diff)
downloadNetworkManager-4ca7fa7f4abfd52e13844013cffa0dbda3146f9a.tar.gz
initrd: add .nmconnection extension when writing keyfiles
initrd does not use keyfile API from "src/settings/plugins/keyfile", hence it does not use nms_keyfile_utils_escape_filename() to add the ".nmconnection" file extension. I think that is problematic, because it also misses escapings which are necessary so that NetworkManager will accept the file. Anyway, the proper solution here would be to move the keyfile utility functions to libnm-core, alongside base keyfile API. That way, it could be used by initrd generator. For now, just dirty fix the generated filename. Fixes: 648c256b9014198aac388097e410999c68c4b452
Diffstat (limited to 'src/initrd')
-rw-r--r--src/initrd/nm-initrd-generator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c
index 5d06f05548..0b4d19bae8 100644
--- a/src/initrd/nm-initrd-generator.c
+++ b/src/initrd/nm-initrd-generator.c
@@ -63,7 +63,8 @@ output_conn (gpointer key, gpointer value, gpointer user_data)
g_print ("%s\n", error->message);
g_error_free (error);
} else if (connections_dir) {
- char *filename = g_build_filename (connections_dir, basename, NULL);
+ gs_free char *basename_w_ext = g_strconcat (basename, ".nmconnection", NULL);
+ char *filename = g_build_filename (connections_dir, basename_w_ext, NULL);
if (!nm_utils_file_set_contents (filename, data, len, 0600, &error)) {
g_print ("%s\n", error->message);