mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:14:12 +08:00
mdbx: don't sync-on-close deleted files.
Change-Id: Ie9358dfd79c9c5b26777e690079b3f081f0a7158
This commit is contained in:
parent
84ae40172e
commit
af6aa30c7c
@ -9012,11 +9012,16 @@ int __cold mdbx_env_close_ex(MDBX_env *env, int dont_sync) {
|
||||
rc = mdbx_env_sync_ex(env, true, false);
|
||||
rc = (rc == MDBX_RESULT_TRUE) ? MDBX_SUCCESS : rc;
|
||||
#else
|
||||
rc = mdbx_env_sync_ex(env, true, true);
|
||||
rc = (rc == MDBX_BUSY || rc == EAGAIN || rc == EACCES || rc == EBUSY ||
|
||||
rc == EWOULDBLOCK || rc == MDBX_RESULT_TRUE)
|
||||
? MDBX_SUCCESS
|
||||
: rc;
|
||||
struct stat st;
|
||||
if (unlikely(fstat(env->me_fd, &st)))
|
||||
rc = errno;
|
||||
else if (st.st_nlink > 0 /* don't sync deleted files */) {
|
||||
rc = mdbx_env_sync_ex(env, true, true);
|
||||
rc = (rc == MDBX_BUSY || rc == EAGAIN || rc == EACCES || rc == EBUSY ||
|
||||
rc == EWOULDBLOCK || rc == MDBX_RESULT_TRUE)
|
||||
? MDBX_SUCCESS
|
||||
: rc;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user