Both the test files and directories added into the test harness are stored
into the same file list. So the parser_scandir() stub compares the absolute
file path of the files and the directory to scan, to know if a file belongs
to the directory.
Files whose absolute file path length isn't bigger than the directory to
scan should just be ignored, since it means they can't be from that dir.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
if (f->dev != ctx->device)
continue;
if (f->dev != ctx->device)
continue;
+ if (strlen(f->name) <= strlen(dirname))
+ continue;
+
filename = strrchr(f->name, '/');
if (!filename)
continue;
filename = strrchr(f->name, '/');
if (!filename)
continue;