diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2013-11-12 15:04:15 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2013-11-12 15:04:15 +0100 |
commit | 07bf4eb802166edc737f2c742f3987a1aa39189e (patch) | |
tree | b80cc8a12014738533a648d0ce852e80ca8e0a07 | |
parent | 696f655d7c7b605d0344aeb6ba4ff643cd46a5b4 (diff) | |
download | NetworkManager-07bf4eb802166edc737f2c742f3987a1aa39189e.tar.gz |
keyfile: don't crash when in-memory-only connections don't have paths
If the connection has never been saved to disk, it won't have a path yet,
but that doesn't mean we should crash. Next, when reloading connections,
only try to do connection matching on connections that have paths, otherwise
all in-memory-only connections would be removed at the end of
read_connections().
-rw-r--r-- | src/settings/plugins/keyfile/plugin.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c index c5fb9e0433..950f566b03 100644 --- a/src/settings/plugins/keyfile/plugin.c +++ b/src/settings/plugins/keyfile/plugin.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2012 Red Hat, Inc. + * Copyright (C) 2008 - 2013 Red Hat, Inc. */ #include <config.h> @@ -345,8 +345,11 @@ read_connections (NMSystemConfigInterface *config) oldconns = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); g_hash_table_iter_init (&iter, priv->connections); - while (g_hash_table_iter_next (&iter, NULL, &data)) - g_hash_table_insert (oldconns, g_strdup (nm_keyfile_connection_get_path (data)), data); + while (g_hash_table_iter_next (&iter, NULL, &data)) { + const char *con_path = nm_keyfile_connection_get_path (data); + if (con_path) + g_hash_table_insert (oldconns, g_strdup (con_path), data); + } while ((item = g_dir_read_name (dir))) { NMKeyfileConnection *connection; |