diff --git a/src/posix/FileSystemPosix.cpp b/src/posix/FileSystemPosix.cpp index b2a2ff8ec31..fb36147b66f 100644 --- a/src/posix/FileSystemPosix.cpp +++ b/src/posix/FileSystemPosix.cpp @@ -61,8 +61,8 @@ namespace FileSystem { path += "Library/Application Support/Pioneer"; #else struct stat info; - stat((path + ".pioneer").c_str(), &info); - if (S_ISDIR(info.st_mode)) { + int err = stat((path + ".pioneer").c_str(), &info); + if (err == 0 && S_ISDIR(info.st_mode)) { // Check for legacy pioneer directory. path += ".pioneer"; } else {