aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-13 16:33:04 +0200
committerMax Kellermann <max@duempel.org>2008-10-13 16:33:04 +0200
commit69617438a9658a2666c0e035529242f38aaf3399 (patch)
treef9579c9ad24e035b1fcd4a5d19e570ba33dcafca /src
parent3b6ff84393985aa9d148d2c00c49630ed2590d7d (diff)
downloadmpd-69617438a9658a2666c0e035529242f38aaf3399.tar.gz
mpd-69617438a9658a2666c0e035529242f38aaf3399.tar.xz
mpd-69617438a9658a2666c0e035529242f38aaf3399.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/dirvec.c5
1 files changed, 4 insertions, 1 deletions
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 <string.h>
@@ -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;
}