Commit b2123a39 authored by Thomas Haller's avatar Thomas Haller

settings: accept missing settings plugins

Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent 4545b6cb
......@@ -70,6 +70,13 @@
#include "nm-config.h"
#include "NetworkManagerUtils.h"
#define LOG(level, ...) \
G_STMT_START { \
nm_log ((level), LOGD_CORE, \
"settings: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__) \
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
} G_STMT_END
/* LINKER CRACKROCK */
#define EXPORT(sym) void * __export_##sym = &sym;
......@@ -620,17 +627,20 @@ load_plugins (NMSettings *self, const char **plugins, GError **error)
for (iter = plugins; iter && *iter; iter++) {
GModule *plugin;
char *full_name, *path;
const char *pname = *iter;
gs_free char *pname = NULL;
GObject *obj;
GObject * (*factory_func) (void);
/* strip leading spaces */
while (g_ascii_isspace (*pname))
pname++;
pname = g_strdup (*iter);
g_strstrip (pname);
if (!*pname)
continue;
/* ifcfg-fedora was renamed ifcfg-rh; handle old configs here */
if (!strcmp (pname, "ifcfg-fedora"))
pname = "ifcfg-rh";
if (!*pname || strchr (pname, '/')) {
LOG (LOGL_WARN, "ignore invalid plugin \"%s\"", pname);
continue;
}
obj = find_plugin (list, pname);
if (obj)
......@@ -650,18 +660,18 @@ load_plugins (NMSettings *self, const char **plugins, GError **error)
plugin = g_module_open (path, G_MODULE_BIND_LOCAL);
if (!plugin) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
"Could not load plugin '%s': %s",
pname, g_module_error ());
LOG (LOGL_WARN, "Could not load plugin '%s': %s",
pname, g_module_error ());
g_free (full_name);
g_free (path);
success = FALSE;
break;
continue;
}
g_free (full_name);
g_free (path);
/* errors after this point are fatal, because we loaded the shared library already. */
if (!g_module_symbol (plugin, "nm_system_config_factory", (gpointer) (&factory_func))) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
"Could not find plugin '%s' factory function.",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment