#include "plugin.h"
#include "prefs.h"
#include "claws.h"
+#include "timing.h"
+
#ifdef HAVE_VALGRIND
#include "valgrind.h"
#endif
PrefFile *pfile;
GSList *type_cur, *plugin_cur;
Plugin *plugin;
-
+
for (type_cur = plugin_types; type_cur != NULL; type_cur = g_slist_next(type_cur)) {
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
#ifdef G_OS_WIN32
continue;
if (!strcmp(plugin->type(), type_cur->data))
- fprintf(pfile->fp, "%s\n", plugin->filename);
+ if (fprintf(pfile->fp, "%s\n", plugin->filename) < 0)
+ goto revert;
}
for (plugin_cur = unloaded_plugins; plugin_cur != NULL; plugin_cur = g_slist_next(plugin_cur)) {
plugin = (Plugin *) plugin_cur->data;
continue;
if (!strcmp(plugin->type(), type_cur->data))
- fprintf(pfile->fp, "%s\n", plugin->filename);
+ if (fprintf(pfile->fp, "%s\n", plugin->filename) < 0)
+ goto revert;
}
- fprintf(pfile->fp, "\n");
+ if (fprintf(pfile->fp, "\n") < 0)
+ goto revert;
if (prefs_file_close(pfile) < 0)
g_warning("failed to write plugin list\n");
g_free(rcpath);
+
+ continue;
+
+revert:
+ g_warning("failed to write plugin list\n");
+ if (prefs_file_close_revert(pfile) < 0)
+ g_warning("failed to revert plugin list\n");
+
+ g_free(rcpath);
}
}
dep_plugin = plugin_load(path, error);
if (dep_plugin == NULL) {
g_free(path);
+ fclose(fp);
return -1;
}
}
const gchar *(*plugin_type)(void);
const gchar *(*plugin_licence)(void);
struct PluginFeature *(*plugin_provides)(void);
-
gint ok;
-
+ START_TIMING((filename?filename:"NULL plugin"));
g_return_val_if_fail(filename != NULL, NULL);
g_return_val_if_fail(error != NULL, NULL);
if (strcmp(plugin_licence(), "GPL2+") && strncmp(plugin_licence(), "GPL3", strlen("GPL3"))
&& strncmp(plugin_licence(), "GPL2+-compatible", strlen("GPL2+-compatible"))) {
- *error = g_strdup(_("This module is not licenced under a GPL v2 or later compatible licence."));
+ *error = g_strdup(_("This module is not licensed under a GPL v2 or later compatible license."));
if (plugin->unloaded_hidden)
return NULL;
g_module_close(plugin->module);
plugin->unloaded_hidden = FALSE;
debug_print("Plugin %s (from file %s) loaded\n", plugin->name(), filename);
-
+ END_TIMING();
return plugin;
}
if ((pfile = prefs_read_open(rcpath)) == NULL ||
(prefs_set_block_label(pfile, block) < 0)) {
g_free(rcpath);
+ if (pfile)
+ prefs_file_close(pfile);
return;
}
g_free(block);