diff options
| -rw-r--r-- | common/iobuf.c | 4 | ||||
| -rw-r--r-- | common/mischelp.c | 3 | ||||
| -rw-r--r-- | kbx/keybox-init.c | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/common/iobuf.c b/common/iobuf.c index 833b90295..770b67c29 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -286,7 +286,6 @@ direct_open (const char *fname, const char *mode, int mode700) return GNUPG_INVALID_FD; da = GENERIC_READ | GENERIC_WRITE; cd = OPEN_EXISTING; - sm = FILE_SHARE_READ | FILE_SHARE_WRITE; } else if (strchr (mode, 'w')) { @@ -294,14 +293,13 @@ direct_open (const char *fname, const char *mode, int mode700) return GNUPG_INVALID_FD; da = GENERIC_WRITE; cd = CREATE_ALWAYS; - sm = FILE_SHARE_WRITE; } else { da = GENERIC_READ; cd = OPEN_EXISTING; - sm = FILE_SHARE_READ; } + sm = FILE_SHARE_READ | FILE_SHARE_WRITE; /* We always use the Unicode version because it supports file names * longer than MAX_PATH. (requires gpgrt 1.45) */ diff --git a/common/mischelp.c b/common/mischelp.c index ef70c9d83..db0bd0521 100644 --- a/common/mischelp.c +++ b/common/mischelp.c @@ -85,6 +85,9 @@ same_file_p (const char *name1, const char *name2) wname = gpgrt_fname_to_wchar (name1); if (wname) { + /* Note that if the desiredAccess (2nd arg) is zero, we are + * allowed to query certain metadata even if GENERIC_READ + * would have not been granted. */ file1 = CreateFileW (wname, 0, 0, NULL, OPEN_EXISTING, 0, NULL); xfree (wname); } diff --git a/kbx/keybox-init.c b/kbx/keybox-init.c index 7bd206383..53c716833 100644 --- a/kbx/keybox-init.c +++ b/kbx/keybox-init.c @@ -283,10 +283,10 @@ _keybox_ll_open (estream_t *rfp, const char *fname, unsigned int mode) fp = es_fopen (fname, mode == KEYBOX_LL_OPEN_CREATE - ? "wb,sysopen,sequential" : + ? "wb,sysopen,sequential,share=rw" : mode == KEYBOX_LL_OPEN_UPDATE - ? "r+b,sysopen,sequential" : - "rb,sysopen,sequential"); + ? "r+b,sysopen,sequential,share=rw" : + "rb,sysopen,sequential,share=rw"); if (!fp) return gpg_error_from_syserror (); |
