dont check process mode on open() failure

This commit is contained in:
guoling
2020-08-18 20:42:11 +08:00
parent f4bdd24b13
commit b6d597f2fd
+5
View File
@@ -208,6 +208,11 @@ void MMKV::checkReSetCryptKey(int fd, int metaFD, string *cryptKey) {
# endif // MMKV_DISABLE_CRYPT
bool MMKV::checkProcessMode() {
// avoid exception on open() error
if (!m_file->isFileValid()) {
return true;
}
if (!m_fileModeLock) {
// force use fcntl(), otherwise will conflict with MemoryFile::reloadFromFile()
m_fileModeLock = new FileLock(m_file->getFd(), true);