Fix compile errors introduced by bfc3363

Fixes #432
This commit is contained in:
d0k3 2018-10-02 18:42:04 +02:00
parent 0286d9cde9
commit e477ec0a18
2 changed files with 9 additions and 8 deletions

View File

@ -181,12 +181,13 @@ void SearchDirContents(DirStruct* contents, const char* path, const char* patter
contents->n_entries = 0; // not required, but so what? contents->n_entries = 0; // not required, but so what?
} else { } else {
// create virtual '..' entry // create virtual '..' entry
contents->entry->p_name = 4; DirEntry* entry = (DirEntry*) &(contents->entry);
contents->entry->name = contents->entry->path + entry->p_name; entry->p_name = 4;
strncpy(contents->entry->path, "*?*", 4); entry->name = entry->path + entry->p_name;
strncpy(contents->entry->name, "..", 4); strncpy(entry->path, "*?*", 4);
contents->entry->type = T_DOTDOT; strncpy(entry->name, "..", 4);
contents->entry->size = 0; entry->type = T_DOTDOT;
entry->size = 0;
contents->n_entries = 1; contents->n_entries = 1;
// search the path // search the path
char fpath[256]; // 256 is the maximum length of a full path char fpath[256]; // 256 is the maximum length of a full path

View File

@ -16,7 +16,7 @@ void SetDirGoodNames(DirStruct* contents) {
continue; continue;
entry->p_name = plen + 1; entry->p_name = plen + 1;
entry->name = entry->path + entry->p_name; entry->name = entry->path + entry->p_name;
strncpy(entry->name, goodname, 256 - 1 - entry->p_name); snprintf(entry->name, 256 - entry->p_name, "%s", goodname);
} }
} }