Commit 69617438 authored by Max Kellermann's avatar Max Kellermann

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.
parent 3b6ff843
#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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment