Fix path for root case
All checks were successful
continuous-integration/drone/push Build is passing

In case of root, res->path returns '.' which does not mix well with
concatenating the entry name. For example this may result in `.bin` for a folder
`bin` in root.
This commit is contained in:
Armin Friedl 2020-08-31 18:58:01 +02:00
parent 66558aa615
commit 48db5eea1d

2
dirl.c
View file

@ -189,7 +189,7 @@ dirl_entry(int fd,
{ {
struct stat stat_buf; struct stat stat_buf;
char* path_buf = calloc(sizeof(char), strlen(res->path)+strlen(entry->d_name)); char* path_buf = calloc(sizeof(char), strlen(res->path)+strlen(entry->d_name));
strcat(path_buf, res->path); strcat(path_buf, res->uri);
strcat(path_buf, entry->d_name); strcat(path_buf, entry->d_name);
lstat(path_buf, &stat_buf); lstat(path_buf, &stat_buf);