From: Jaroslav Kysela Date: Tue, 19 Nov 2019 09:55:29 +0000 (+0100) Subject: conf: check for include path duplicates X-Git-Tag: v1.2.1.1~7 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=c28618353b3f5d90e144bef56c52619ad8769520;p=alsa-lib.git conf: check for include path duplicates Signed-off-by: Jaroslav Kysela --- diff --git a/src/conf.c b/src/conf.c index f9e9a395..e4306504 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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)