]> git.alsa-project.org Git - alsa-lib.git/commitdiff
conf: check for include path duplicates
authorJaroslav Kysela <perex@perex.cz>
Tue, 19 Nov 2019 09:55:29 +0000 (10:55 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 19 Nov 2019 09:55:29 +0000 (10:55 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/conf.c

index f9e9a3954821fcecf2101bbaa27e3eeae8df43fe..e430650430d1bad94616e077c4cc319f652e53b3 100644 (file)
@@ -528,6 +528,17 @@ static inline void snd_config_unlock(void) { }
 static int add_include_path(struct filedesc *fd, const char *dir)
 {
        struct include_path *path;
+       struct filedesc *fd1;
+       struct list_head *pos;
+
+       /* check, if dir is already registered (also in parents) */
+       for (fd1 = fd; fd1; fd1 = fd1->next) {
+               list_for_each(pos, &fd1->include_paths) {
+                       path = list_entry(pos, struct include_path, list);
+                       if (strcmp(path->dir, dir) == 0)
+                               return 0;
+               }
+       }
 
        path = calloc(1, sizeof(*path));
        if (!path)