summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-04-17 13:24:32 +0200
committerThomas Haller <thaller@redhat.com>2015-04-17 13:30:30 +0200
commit6b0f84bddaae8d315aaa28997b0ab7e71d3be091 (patch)
tree02359a87613420d9c83a9d551dd5a9555198ef52
parent9d3b31e1aee712094c7df582beb548580daa18cb (diff)
downloadNetworkManager-6b0f84bddaae8d315aaa28997b0ab7e71d3be091.tar.gz
config: fix filename order for config-description
The configuration snippets are loaded in alphabetical order. Fix the printed description to reflect that order. Otherwise, NM logs at startup: <info> Read config: /etc/NetworkManager/NetworkManager.conf and conf.d: 20-connectivity-fedora.conf, 10-ibft-plugin.conf
-rw-r--r--src/nm-config.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/nm-config.c b/src/nm-config.c
index eabb378664..3dbe58fb90 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -571,6 +571,7 @@ _get_config_dir_files (const char *config_main_file,
GPtrArray *confs;
GString *config_description;
const char *name;
+ guint i;
g_return_val_if_fail (config_main_file, NULL);
g_return_val_if_fail (config_dir, NULL);
@@ -583,21 +584,27 @@ _get_config_dir_files (const char *config_main_file,
if (direnum) {
while ((info = g_file_enumerator_next_file (direnum, NULL, NULL))) {
name = g_file_info_get_name (info);
- if (g_str_has_suffix (name, ".conf")) {
- g_ptr_array_add (confs, g_build_filename (config_dir, name, NULL));
- if (confs->len == 1)
- g_string_append (config_description, " and conf.d: ");
- else
- g_string_append (config_description, ", ");
- g_string_append (config_description, name);
- }
+ if (g_str_has_suffix (name, ".conf"))
+ g_ptr_array_add (confs, g_strdup (name));
g_object_unref (info);
}
g_object_unref (direnum);
}
g_object_unref (dir);
- g_ptr_array_sort (confs, sort_asciibetically);
+ if (confs->len > 0) {
+ g_ptr_array_sort (confs, sort_asciibetically);
+ g_string_append (config_description, " and conf.d: ");
+ for (i = 0; i < confs->len; i++) {
+ char *n = confs->pdata[i];
+
+ if (i > 0)
+ g_string_append (config_description, ", ");
+ g_string_append (config_description, n);
+ confs->pdata[i] = g_build_filename (config_dir, n, NULL);
+ g_free (n);
+ }
+ }
*out_config_description = g_string_free (config_description, FALSE);
return confs;