diff options
Diffstat (limited to 'common/file-list.c')
-rw-r--r-- | common/file-list.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/common/file-list.c b/common/file-list.c index 0b760c1aec..e13d5af659 100644 --- a/common/file-list.c +++ b/common/file-list.c @@ -23,7 +23,13 @@ struct file_list_entry *file_list_entry_by_name(struct file_list *files, const c int file_list_add_entry(struct file_list *files, const char *name, const char *filename, unsigned long flags) { - struct file_list_entry *entry = xzalloc(sizeof(*entry)); + struct file_list_entry *entry; + + entry = file_list_entry_by_name(files, name); + if (entry) + return -EEXIST; + + entry = xzalloc(sizeof(*entry)); entry->name = xstrdup(name); entry->filename = xstrdup(filename); |