Skip to content

bug lstat uses wrong path  #31

@luke-goddard

Description

@luke-goddard

enumy/src/file_system.c

Lines 60 to 73 in 86a11f9

unsigned char get_d_type(struct dirent* entry, const char* location) {
struct stat statbuf;
unsigned char rv = DT_UNKNOWN;
if (DT_UNKNOWN == entry->d_type){
char filepath[MAXSIZE];
strncpy(filepath, location, MAXSIZE - 1);
strncat(filepath, entry->d_name, MAXSIZE - 1);
// The call to lstat here might not be thread safe, if the call is being made on the same file at the same time.
// I think there ius no way that this happens at the moment, but am not sure at all.
// Could globally lock this or do some sort of filesystem hash to make this more fine-grained etc.
if(-1 != lstat(entry->d_name, &statbuf))

lstat should use filepath not the file name

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions