Jiri, can you take a look?
--
vda
diff -x '*.po' -d -urpN libreport.5/src/include/internal_libreport.h libreport.6/src/include/internal_libreport.h
--- libreport.5/src/include/internal_libreport.h 2012-12-06 16:18:16.000000000 +0100
+++ libreport.6/src/include/internal_libreport.h 2012-12-17 15:37:21.072132982 +0100
@@ -635,7 +635,7 @@ void set_user_setting(const char *name,
const char *get_user_setting(const char *name);
#define load_forbidden_words libreport_load_forbidden_words
GList *load_forbidden_words();
-#define get_file_list libreport_get_file_list
+#define get_file_list libreport_get_file_list
GList *get_file_list(const char *path, const char *ext);
#define free_file_list libreport_free_file_list
void free_file_list(GList *filelist);
diff -x '*.po' -d -urpN libreport.5/src/lib/event_config.c libreport.6/src/lib/event_config.c
--- libreport.5/src/lib/event_config.c 2012-12-04 15:40:28.000000000 +0100
+++ libreport.6/src/lib/event_config.c 2012-12-17 15:45:04.447609189 +0100
@@ -137,9 +137,8 @@ event_option_t *get_event_option_from_li
static void load_config_files(const char *dir_path)
{
-
GList *conf_files = get_file_list(dir_path, "conf");
- while(conf_files != NULL)
+ while (conf_files != NULL)
{
file_obj_t *file = (file_obj_t *)conf_files->data;
char *fullpath = file->fullpath;
@@ -186,9 +185,9 @@ static void load_config_files(const char
if (new_config)
g_hash_table_replace(g_event_config_list, xstrdup(ec_get_name(event_config)), event_config);
- conf_files = g_list_next(conf_files);
+ free_file_obj(file);
+ conf_files = g_list_delete_link(conf_files, conf_files);
}
- free_file_list(conf_files);
}
/* (Re)loads data from /etc/abrt/events/foo.{xml,conf} and $XDG_CACHE_HOME/abrt/events/foo.conf */
@@ -226,9 +225,9 @@ GHashTable *load_event_config_data(void)
if (new_config)
g_hash_table_replace(g_event_config_list, xstrdup(ec_get_name(event_config)), event_config);
- event_files = g_list_next(event_files);
+ free_file_obj(file);
+ event_files = g_list_delete_link(event_files, event_files);
}
- free_file_list(event_files);
load_config_files(EVENTS_DIR);
diff -x '*.po' -d -urpN libreport.5/src/lib/file_list.c libreport.6/src/lib/file_list.c
--- libreport.5/src/lib/file_list.c 2012-11-20 13:33:02.000000000 +0100
+++ libreport.6/src/lib/file_list.c 2012-12-17 15:46:07.948538421 +0100
@@ -21,14 +21,14 @@
GList *get_file_list(const char *path, const char *ext_filter)
{
- GList * files = NULL;
- DIR *dir;
- struct dirent *dent;
-
/* Load .$ext files */
+ DIR *dir;
dir = opendir(path);
if (!dir)
return NULL;
+
+ GList *files = NULL;
+ struct dirent *dent;
while ((dent = readdir(dir)) != NULL)
{
char *ext = strrchr(dent->d_name, '.');
@@ -40,9 +40,11 @@ GList *get_file_list(const char *path, c
char *fullname = concat_path_file(path, dent->d_name);
*ext = '\0';
+//TODO: get rid of special handling of symlinks?
struct stat buf;
if (0 != lstat(fullname, &buf))
- continue;
+ goto next;
+
if (S_ISLNK(buf.st_mode))
{
GError *error = NULL;
@@ -52,6 +54,8 @@ GList *get_file_list(const char *path, c
gchar *target = g_path_get_basename(link);
char *ext = strrchr(target, '.');
+
+//FIXME: why "xml"? Shouldn't it be ext_filter?
if (!ext || 0 != strcmp(ext + 1, "xml"))
error_msg_and_die("Invalid event symlink '%s': expected it to"
" point to another xml file", fullname);
@@ -60,13 +64,16 @@ GList *get_file_list(const char *path, c
//g_hash_table_replace(g_event_config_symlinks, xstrdup(dent->d_name), target);
g_free(link);
/* don't free target, it is owned by the hash table now */
- continue;
+
+ goto next;
}
file_obj_t *file = new_file_obj(fullname, dent->d_name);
files = g_list_prepend(files, file);
-
+ next:
+ free(fullname);
}
+
closedir(dir);
return files;
}
diff -x '*.po' -d -urpN libreport.5/src/lib/workflow.c libreport.6/src/lib/workflow.c
--- libreport.5/src/lib/workflow.c 2012-12-10 13:13:03.000000000 +0100
+++ libreport.6/src/lib/workflow.c 2012-12-17 15:44:44.365631616 +0100
@@ -129,7 +129,7 @@ GHashTable *load_workflow_config_data(co
}
GList *workflow_files = get_file_list(path, "xml");
- while(workflow_files)
+ while (workflow_files)
{
file_obj_t *file = (file_obj_t *)workflow_files->data;
@@ -143,9 +143,9 @@ GHashTable *load_workflow_config_data(co
if (nw_workflow)
g_hash_table_replace(g_workflow_list, xstrdup(wf_get_name(workflow)), workflow);
- workflow_files = g_list_next(workflow_files);
+ free_file_obj(file);
+ workflow_files = g_list_delete_link(workflow_files, workflow_files);
}
- free_file_list(workflow_files);
return g_workflow_list;
}