Skip to content

Commit cae0576

Browse files
committed
fix sftp.exe client to transfer files in binary mode
sftp.exe client were adding crlf to each lines of files. It should transfer in binary mode. set O_BINARY flag on in _open calls.
1 parent 5b06ebb commit cae0576

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sftp-client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ do_download(struct sftp_conn *conn, const char *remote_path,
13131313
#ifdef WIN32_FIXME
13141314

13151315
local_fd = _open(local_path,
1316-
O_WRONLY | O_CREAT | (resume_flag ? 0 : O_TRUNC), mode | S_IWUSR);
1316+
O_WRONLY | O_CREAT | O_BINARY | (resume_flag ? 0 : O_TRUNC), mode | S_IWUSR);
13171317

13181318
#else
13191319
local_fd = open(local_path,
@@ -1704,7 +1704,7 @@ do_upload(struct sftp_conn *conn, const char *local_path,
17041704

17051705
#ifdef WIN32_FIXME
17061706

1707-
if ((local_fd = _open(local_path, O_RDONLY, 0)) == -1) {
1707+
if ((local_fd = _open(local_path, O_RDONLY | O_BINARY, 0)) == -1) {
17081708

17091709
#else
17101710

0 commit comments

Comments
 (0)