Skip to content

Commit

Permalink
throw an exception only on Android if File::unlock has failed
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-cab committed Aug 24, 2023
1 parent 060c0a3 commit 2dcd03f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Enhancements
* <New feature description> (PR [#????](https://github.com/realm/realm-core/pull/????))
* Added support for server log messages that are enabled by sync protocol version 10. Appservices request id will be provided in a server log message in a future server release. ([PR #6476](https://github.com/realm/realm-core/pull/6476))
* Throw an exception if `File::unlock` has failed, in order to inform the SDK that we are likely hitting some limitation on the OS filesystem, instead of crashing the application.([PR #6926](https://github.com/realm/realm-core/pull/6926))

### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
Expand Down
5 changes: 4 additions & 1 deletion src/realm/util/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,10 @@ static void _unlock(int m_fd)
do {
r = flock(m_fd, LOCK_UN);
} while (r != 0 && errno == EINTR);
REALM_ASSERT_RELEASE_EX(r == 0 && "File::unlock()", r, errno);
if (r && errno) {
throw RuntimeError(ErrorCodes::RuntimeError,
"File::unlock() has failed, this is likely due to some limitation in the OS file system.");
}
}
#endif

Expand Down

0 comments on commit 2dcd03f

Please sign in to comment.