Fix use of uninitialized value. (#5867)

If the stat command fails, statbuf is uninitialized.
This commit is contained in:
Marco Feuerstein
2024-11-06 10:54:14 +01:00
committed by GitHub
parent e06b80f6b0
commit 6520354a58

View File

@@ -104,7 +104,9 @@ bool DefaultIOSystem::Exists(const char *pFile) const {
}
#else
struct stat statbuf;
stat(pFile, &statbuf);
if (stat(pFile, &statbuf) != 0) {
return false;
}
// test for a regular file
if (!S_ISREG(statbuf.st_mode)) {
return false;