diff options
author | Thomas Lang <thomas.lang@mec.at> | 2021-02-26 11:26:04 +0100 |
---|---|---|
committer | David Oberhollenzer <goliath@infraroot.at> | 2021-02-28 13:23:21 +0100 |
commit | 12d2eed307a36c043884ccfd9fac1b6d861ce235 (patch) | |
tree | 59cf5e4ff1e4affdceedce688918f9838a5a8fc1 /lib/sqfs | |
parent | 711650ee7c0799c56c177dd363fe43dc9492c3aa (diff) |
added shared read access when opening sqfs image with read-only flags (win32)
Diffstat (limited to 'lib/sqfs')
-rw-r--r-- | lib/sqfs/win32/io_file.c | 6 |
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) { |