mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Ensure that sceIoOpen() fails on directories.
This commit is contained in:
parent
2186892381
commit
f976c309b4
1 changed files with 12 additions and 0 deletions
|
@ -218,6 +218,7 @@ bool DirectoryFileHandle::Open(std::string& basePath, std::string& fileName, Fil
|
|||
|
||||
hFile = open(fullName.c_str(), flags, 0666);
|
||||
bool success = hFile != -1;
|
||||
|
||||
#endif
|
||||
|
||||
#if HOST_IS_CASE_SENSITIVE
|
||||
|
@ -240,6 +241,17 @@ bool DirectoryFileHandle::Open(std::string& basePath, std::string& fileName, Fil
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
if (success) {
|
||||
struct stat st;
|
||||
if (fstat(hFile, &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
close(hFile);
|
||||
errno = EISDIR;
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue