mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 01:14:13 +08:00
mdbx-chk: don't use internal mdbx_filesize().
Change-Id: I539b92f345ba7884629b702b2568ca805466be3a
This commit is contained in:
parent
5b09105a6d
commit
cfaed9d761
@ -1080,7 +1080,25 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
uint64_t dxb_filesize = 0;
|
||||
rc = mdbx_filesize(dxb_fd, &dxb_filesize);
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
{
|
||||
BY_HANDLE_FILE_INFORMATION info;
|
||||
if (!GetFileInformationByHandle(dxb_fd, &info))
|
||||
rc = GetLastError();
|
||||
else
|
||||
dxb_filesize = info.nFileSizeLow | (uint64_t)info.nFileSizeHigh << 32;
|
||||
}
|
||||
#else
|
||||
{
|
||||
struct stat st;
|
||||
STATIC_ASSERT_MSG(sizeof(off_t) <= sizeof(uint64_t),
|
||||
"libmdbx requires 64-bit file I/O on 64-bit systems");
|
||||
if (fstat(dxb_fd, &st))
|
||||
rc = errno;
|
||||
else
|
||||
dxb_filesize = st.st_size;
|
||||
}
|
||||
#endif
|
||||
if (rc) {
|
||||
error("mdbx_filesize failed, error %d %s\n", rc, mdbx_strerror(rc));
|
||||
goto bailout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user