mjansson / foundation_lib

Cross-platform public domain foundation library in C providing basic support data types and functions to write applications and games in a platform-independent fashion.
The Unlicense
301 stars 23 forks source link

Maybe a bug in POSIX fs_is_file #24

Closed pbtrung closed 6 years ago

pbtrung commented 6 years ago

bool fs_is_file(const char* path, size_t length) On Arch Linux if path does not exist, returned value is random. Solution:

int rc = stat(finalpath.str, &st);
if (rc == 0 && (st.st_mode & S_IFREG))
    return true;
mjansson commented 6 years ago

Added stat return value checks and unified the file/dir checks in 052e7e015

pbtrung commented 6 years ago

Looks good now. Thanks.