mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-23 09:04:26 +08:00
mdbx: add mdbx_osal.h with platform-like err codes.
This commit is contained in:
280
src/mdbx.c
280
src/mdbx.c
File diff suppressed because it is too large
Load Diff
@@ -337,7 +337,7 @@ int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t bytes, off_t offset) {
|
||||
if (unlikely(!ReadFile(fd, buf, (DWORD)bytes, &read, &ov))) {
|
||||
int rc = GetLastError();
|
||||
if (rc == ERROR_HANDLE_EOF && read == 0 && offset == 0)
|
||||
return ENOENT;
|
||||
return MDBX_ENODATA;
|
||||
return rc;
|
||||
}
|
||||
return (read == bytes) ? MDB_SUCCESS : ERROR_READ_FAULT;
|
||||
@@ -347,7 +347,7 @@ int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t bytes, off_t offset) {
|
||||
return MDB_SUCCESS;
|
||||
if (read < 0)
|
||||
return errno;
|
||||
return (read == 0 && offset == 0) ? ENOENT : EIO;
|
||||
return (read == 0 && offset == 0) ? MDBX_ENODATA : EIO;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
|
Reference in New Issue
Block a user