stash for ohos backup & restore

This commit is contained in:
guoling
2024-04-09 16:27:25 +08:00
parent 540cf78c39
commit 2b8fd0cc21
9 changed files with 348 additions and 19 deletions
+6 -1
View File
@@ -60,12 +60,17 @@ bool tryAtomicRename(const MMKVPath_t &srcPath, const MMKVPath_t &dstPath) {
if (g_renameat2) {
renamed = (g_renameat2(AT_FDCWD, srcPath.c_str(), AT_FDCWD, dstPath.c_str(), RENAME_EXCHANGE) == 0);
}
if (!renamed && errno != ENOENT) {
MMKVWarning("fail on renameat2() [%s] to [%s], %d(%s)", srcPath.c_str(), dstPath.c_str(), errno,
strerror(errno));
}
#endif
if (!renamed) {
renamed = (syscall(SYS_renameat2, AT_FDCWD, srcPath.c_str(), AT_FDCWD, dstPath.c_str(), RENAME_EXCHANGE) == 0);
}
if (!renamed && errno != ENOENT) {
MMKVError("fail on renameat2() [%s] to [%s], %d(%s)", srcPath.c_str(), dstPath.c_str(), errno, strerror(errno));
MMKVWarning("fail on syscall(SYS_renameat2) [%s] to [%s], %d(%s)", srcPath.c_str(), dstPath.c_str(), errno,
strerror(errno));
}
#endif // SYS_renameat2