summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Lang <thomas.lang@mec.at>2021-02-26 11:26:04 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-02-28 13:26:53 +0100
commitb3efb637c8e1dc5cbb557e90988b5537cc6aff61 (patch)
tree9fe392c9a817343dc4680d58abf5d8db757b71ed /lib
parent6bab038b79615e4b2de112879ec415b68096b244 (diff)
added shared read access when opening sqfs image with read-only flags (win32)
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfs/win32/io_file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqfs/win32/io_file.c b/lib/sqfs/win32/io_file.c
index 836aa37..7ff42b7 100644
--- a/lib/sqfs/win32/io_file.c
+++ b/lib/sqfs/win32/io_file.c
@@ -151,7 +151,7 @@ static int stdio_truncate(sqfs_file_t *base, sqfs_u64 size)
sqfs_file_t *sqfs_open_file(const char *filename, sqfs_u32 flags)
{
- int access_flags, creation_mode;
+ int access_flags, creation_mode, share_mode;
sqfs_file_stdio_t *file;
LARGE_INTEGER size;
sqfs_file_t *base;
@@ -168,9 +168,11 @@ sqfs_file_t *sqfs_open_file(const char *filename, sqfs_u32 flags)
file->readonly = true;
access_flags = GENERIC_READ;
creation_mode = OPEN_EXISTING;
+ share_mode = FILE_SHARE_READ;
} else {
file->readonly = false;
access_flags = GENERIC_READ | GENERIC_WRITE;
+ share_mode = 0;
if (flags & SQFS_FILE_OPEN_OVERWRITE) {
creation_mode = CREATE_ALWAYS;
@@ -179,7 +181,7 @@ sqfs_file_t *sqfs_open_file(const char *filename, sqfs_u32 flags)
}
}
- file->fd = CreateFile(filename, access_flags, 0, NULL, creation_mode,
+ file->fd = CreateFile(filename, access_flags, share_mode, NULL, creation_mode,
FILE_ATTRIBUTE_NORMAL, NULL);
if (file->fd == INVALID_HANDLE_VALUE) {