Skip to content

Commit

Permalink
Merge pull request #617 from JacobBarthelmeh/files
Browse files Browse the repository at this point in the history
do not require locking file with SFTP on Windows
  • Loading branch information
ejohnstown authored Nov 14, 2023
2 parents 4d201d7 + 2d3956e commit de5b6a3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/wolfsftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2171,8 +2171,9 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
}
#endif

fileHandle = WS_CreateFileA(dir, desiredAccess, 0, creationDisp,
FILE_ATTRIBUTE_NORMAL, ssh->ctx->heap);
fileHandle = WS_CreateFileA(dir, desiredAccess,
(FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE),
creationDisp, FILE_ATTRIBUTE_NORMAL, ssh->ctx->heap);
if (fileHandle == INVALID_HANDLE_VALUE) {
WLOG(WS_LOG_SFTP, "Error opening file %s", dir);
res = oer;
Expand Down Expand Up @@ -8512,8 +8513,9 @@ int wolfSSH_SFTP_Get(WOLFSSH* ssh, char* from,
if (state->gOfst > 0)
desiredAccess |= FILE_APPEND_DATA;
state->fileHandle = WS_CreateFileA(to, desiredAccess,
0, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, ssh->ctx->heap);
(FILE_SHARE_DELETE | FILE_SHARE_READ |
FILE_SHARE_WRITE), CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, ssh->ctx->heap);
}
if (resume) {
WMEMSET(&state->offset, 0, sizeof(OVERLAPPED));
Expand Down

0 comments on commit de5b6a3

Please sign in to comment.