From 69617438a9658a2666c0e035529242f38aaf3399 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Oct 2008 16:33:04 +0200 Subject: dirvec: dirvec_find() compares basename It is invalid to pass a path with the wrong dirname to dirvec_find(). To be able to find a subdirectory only by its basename, compare only the basename of both paths. --- src/dirvec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dirvec.c b/src/dirvec.c index 7f495b3fe..72b1c0084 100644 --- a/src/dirvec.c +++ b/src/dirvec.c @@ -1,6 +1,7 @@ #include "dirvec.h" #include "directory.h" #include "utils.h" +#include "path.h" #include @@ -26,8 +27,10 @@ struct directory *dirvec_find(const struct dirvec *dv, const char *path) { int i; + path = mpd_basename(path); + for (i = dv->nr; --i >= 0; ) - if (!strcmp(dv->base[i]->path, path)) + if (!strcmp(directory_get_name(dv->base[i]), path)) return dv->base[i]; return NULL; } -- cgit v1.2.3