summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Lewandowski <k.lewandowsk@samsung.com>2020-05-05 19:36:57 +0000
committerGerrit Code Review <gerrit@review>2020-05-05 19:36:57 +0000
commitdcae7293b2c664d0c569ee6c0deab5e1855483c5 (patch)
tree274143a1efc9e5f8269bbb5946af908c2fa92220
parenta44d64f24c7efb520a1d36601cb844d0176d63e6 (diff)
parent54d6539acb7564445ad74a9d9c12117665e5a0de (diff)
downloadcrash-worker-dcae7293b2c664d0c569ee6c0deab5e1855483c5.tar.gz
crash-worker-dcae7293b2c664d0c569ee6c0deab5e1855483c5.tar.bz2
crash-worker-dcae7293b2c664d0c569ee6c0deab5e1855483c5.zip
Merge "Returns unique file paths from the maps file" into tizen
-rw-r--r--src/crash-manager/so-info.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/crash-manager/so-info.c b/src/crash-manager/so-info.c
index 5dc26ff..d2526d7 100644
--- a/src/crash-manager/so-info.c
+++ b/src/crash-manager/so-info.c
@@ -215,6 +215,19 @@ static char *get_exe_filename(char *line)
return NULL;
}
+bool list_contains_string(GSList *list, const char *string, const size_t max_len)
+{
+ if (list == NULL || string == NULL)
+ return false;
+
+ for (GSList *iterator = list; iterator; iterator = iterator->next) {
+ if (strncmp((char*)iterator->data, string, max_len) == 0)
+ return true;
+ }
+
+ return false;
+}
+
GSList *get_filepaths(char *map_path)
{
char *line = NULL;
@@ -242,7 +255,10 @@ GSList *get_filepaths(char *map_path)
snprintf(file_name, n+1, "%s", exe_filename);
- file_list = g_slist_append(file_list, file_name);
+ if (!list_contains_string(file_list, file_name, PATH_MAX))
+ file_list = g_slist_append(file_list, file_name);
+ else
+ free(file_name);
}
}