Skip to content

Commit 961810b

Browse files
committed
Fix wrong bitwise operator for testing attribute
Was using OR to check if a bit was set in the read-only file attribute. This was always succeeding. Needed to change to an AND to see if it is set. Affected function: GetFileStats.
1 parent d6e1b04 commit 961810b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wolfscp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,7 @@ static int GetFileStats(void *fs, ScpSendCtx* ctx, const char* fileName,
22182218
(word64)ctx->s.ftLastWriteTime.dwLowDateTime;
22192219

22202220
*fileMode = 0555 |
2221-
(ctx->s.dwFileAttributes | FILE_ATTRIBUTE_READONLY ? 0 : 0200);
2221+
(ctx->s.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? 0 : 0200);
22222222
*fileMode |= (ctx->s.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? 0x4000 : 0;
22232223
#else
22242224
if (WSTAT(fs, fileName, &ctx->s) < 0) {

0 commit comments

Comments
 (0)