From 4db9e0b3ac4872b0f60185cbd79c4392c903ac01 Mon Sep 17 00:00:00 2001 From: James Stone Date: Thu, 11 Jan 2024 10:44:01 -0800 Subject: [PATCH] fallback to manually consume space if posix_fallocate isn't supported at runtime --- CHANGELOG.md | 2 +- src/realm/util/file.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0e79bc3e52..804dd2483e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) -* None. +* Handle `EOPNOTSUPP` when using `posix_fallocate()` and fallback to manually consume space. This should enable android users to open a Realm on restrictive filesystems. ([realm-js #6349](https://github.com/realm/realm-js/issues/6349), more prevalent since v13.23.3 with the change to `REALM_HAVE_POSIX_FALLOCATE` but it was also an issue in some platforms before this) ### Breaking changes * `App::get_uncached_app(...)` and `App::get_shared_app(...)` have been replaced by `App::get_app(App::CacheMode, ...)`. The App constructor is now enforced to be unusable, use `App::get_app()` instead. ([#7237](https://github.com/realm/realm-core/issues/7237)) diff --git a/src/realm/util/file.cpp b/src/realm/util/file.cpp index 1ebd743cf2c..e30af8c5ca4 100644 --- a/src/realm/util/file.cpp +++ b/src/realm/util/file.cpp @@ -1010,7 +1010,7 @@ bool File::prealloc_if_supported(SizeType offset, size_t size) return true; } - if (status == EINVAL || status == EPERM) { + if (status == EINVAL || status == EPERM || status == EOPNOTSUPP) { return false; // Retry with non-atomic version }