From cae05764b0833142d49fcda71f351d29c9cbd715 Mon Sep 17 00:00:00 2001 From: quamrulmina Date: Thu, 1 Oct 2015 01:17:11 -0500 Subject: [PATCH] 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. --- sftp-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sftp-client.c b/sftp-client.c index 09b1271..582fb5f 100644 --- a/sftp-client.c +++ b/sftp-client.c @@ -1313,7 +1313,7 @@ do_download(struct sftp_conn *conn, const char *remote_path, #ifdef WIN32_FIXME local_fd = _open(local_path, - O_WRONLY | O_CREAT | (resume_flag ? 0 : O_TRUNC), mode | S_IWUSR); + O_WRONLY | O_CREAT | O_BINARY | (resume_flag ? 0 : O_TRUNC), mode | S_IWUSR); #else local_fd = open(local_path, @@ -1704,7 +1704,7 @@ do_upload(struct sftp_conn *conn, const char *local_path, #ifdef WIN32_FIXME - if ((local_fd = _open(local_path, O_RDONLY, 0)) == -1) { + if ((local_fd = _open(local_path, O_RDONLY | O_BINARY, 0)) == -1) { #else