From 2a740d3807b60491a23ab9b1c258ef47d44cad15 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 24 Nov 2020 15:41:08 +0300 Subject: [PATCH] mdbx-windows: fix `ERROR_NOT_SUPPORTED` while opening UNC pathnames. Resolve https://github.com/miranda-ng/miranda-ng/issues/2627 Change-Id: Iec06554dfcb9e0db215662d93fb5824cfe9ac7ef --- src/core.c | 4 +++- src/osal.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index 37b8ed19..ab2ef829 100644 --- a/src/core.c +++ b/src/core.c @@ -10118,7 +10118,9 @@ static __cold int mdbx_setup_lck(MDBX_env *env, char *lck_pathname, /* ensure the file system is read-only */ err = mdbx_check_fs_rdonly(env->me_lazy_fd, lck_pathname, err); - if (err != MDBX_SUCCESS) + if (err != MDBX_SUCCESS && + /* ignore ERROR_NOT_SUPPORTED for exclusive mode */ + !(err == MDBX_ENOSYS && (env->me_flags & MDBX_EXCLUSIVE))) return err; /* LY: without-lck mode (e.g. exclusive or on read-only filesystem) */ diff --git a/src/osal.c b/src/osal.c index 72b19cfd..f263346b 100644 --- a/src/osal.c +++ b/src/osal.c @@ -120,6 +120,9 @@ typedef struct _FILE_PROVIDER_EXTERNAL_INFO_V1 { #ifndef STATUS_INVALID_DEVICE_REQUEST #define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS)0xC0000010L) #endif +#ifndef STATUS_NOT_SUPPORTED +#define STATUS_NOT_SUPPORTED ((NTSTATUS)0xC00000BBL) +#endif #ifndef FILE_DEVICE_FILE_SYSTEM #define FILE_DEVICE_FILE_SYSTEM 0x00000009 @@ -1067,7 +1070,8 @@ static int mdbx_check_fs_local(mdbx_filehandle_t handle, int flags) { if (!(flags & MDBX_EXCLUSIVE)) return ERROR_REMOTE_STORAGE_MEDIA_ERROR; } else if (rc != STATUS_OBJECT_NOT_EXTERNALLY_BACKED && - rc != STATUS_INVALID_DEVICE_REQUEST) + rc != STATUS_INVALID_DEVICE_REQUEST && + rc != STATUS_NOT_SUPPORTED) return ntstatus2errcode(rc); }