From 8eb53b853dcc4b0cc8e240cff6bfc5acb92182b0 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 11 May 2018 22:44:44 +0430 Subject: [PATCH] Minor, make CreateFile compatible with the disabled writable flag "writable" is not in use and probably we can go in the reverse direction and remove the flags that are useful for enabled writable, this is just for the sake of completeness however. --- src/hb-blob.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 02e3826c..0beb024e 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -556,8 +556,9 @@ hb_blob_create_from_file (const char *file_name) if (unlikely (file->contents == MAP_FAILED)) goto fail; #elif defined(_WIN32) || defined(__CYGWIN__) - HANDLE fd = CreateFile (file_name, GENERIC_READ, FILE_SHARE_READ, nullptr, - OPEN_EXISTING, + HANDLE fd = CreateFile (file_name, + writable ? GENERIC_READ|GENERIC_WRITE : GENERIC_READ, + FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr); # define CLOSE CloseHandle -- GitLab