diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/core/utils.c | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/src/lib/core/utils.c b/src/lib/core/utils.c index c03f8fa..aa4173c 100644 --- a/src/lib/core/utils.c +++ b/src/lib/core/utils.c @@ -766,7 +766,15 @@ struct StrList *listdir(const char *path) {          if (!strcmp(rec->d_name, ".") || !strcmp(rec->d_name, "..")) {              continue;          } -        strlist_append(&node, rec->d_name); +        char *fullpath = join_ex("/", path, rec->d_name, NULL); +        if (!fullpath) { +            SYSERROR("%s", "Unable to allocate bytes to construct full path"); +            guard_strlist_free(&node); +            closedir(dp); +            return NULL; +        } +        strlist_append(&node, fullpath); +        guard_free(fullpath);      }      closedir(dp);      return node; @@ -791,8 +799,6 @@ int mkdirs(const char *_path, mode_t mode) {      char result[PATH_MAX] = {0};      int status = 0;      while ((token = strsep(&path, "/")) != NULL && !status) { -        if (token[0] == '.') -            continue;          strcat(result, token);          strcat(result, "/");          status = mkdir(result, mode); | 
