mirror of
https://github.com/Tencent/MMKV.git
synced 2026-10-17 04:30:56 +08:00
OHOS doesnt have renameat2() eventhough the macro SYS_renameat2 is defined
This commit is contained in:
@@ -54,7 +54,7 @@ bool tryAtomicRename(const MMKVPath_t &srcPath, const MMKVPath_t &dstPath) {
|
||||
bool renamed = false;
|
||||
|
||||
// try renameat2() first
|
||||
#ifdef SYS_renameat2
|
||||
#if defined(SYS_renameat2) && !defined(MMKV_OHOS)
|
||||
#ifdef MMKV_ANDROID
|
||||
static auto g_renameat2 = (renameat2_t) dlsym(RTLD_DEFAULT, "renameat2");
|
||||
if (g_renameat2) {
|
||||
@@ -72,7 +72,7 @@ bool tryAtomicRename(const MMKVPath_t &srcPath, const MMKVPath_t &dstPath) {
|
||||
MMKVWarning("fail on syscall(SYS_renameat2) [%s] to [%s], %d(%s)", srcPath.c_str(), dstPath.c_str(), errno,
|
||||
strerror(errno));
|
||||
}
|
||||
#endif // SYS_renameat2
|
||||
#endif // SYS_renameat2 && !MMKV_OHOS
|
||||
|
||||
if (!renamed) {
|
||||
if (::rename(srcPath.c_str(), dstPath.c_str()) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user