5017ec
From cc52b2d89397ff26b01d791cd1c605cba741aaa4 Mon Sep 17 00:00:00 2001
5017ec
From: =?UTF-8?q?Felix=20H=C3=A4dicke?= <felixhaedicke@web.de>
5017ec
Date: Wed, 24 Jul 2019 11:47:51 +0200
5017ec
Subject: [PATCH] ssh-libssh: do not specify O_APPEND when not in append mode
5017ec
5017ec
Specifying O_APPEND in conjunction with O_TRUNC and O_CREAT does not
5017ec
make much sense. And this combination of flags is not accepted by all
5017ec
SFTP servers (at least not Apache SSHD).
5017ec
5017ec
Fixes #4147
5017ec
Closes #4148
5017ec
5017ec
Upstream-commit: 62617495102c60124db8a909f592f063e38a89aa
5017ec
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
5017ec
---
5017ec
 lib/ssh-libssh.c | 2 +-
5017ec
 1 file changed, 1 insertion(+), 1 deletion(-)
5017ec
5017ec
diff --git a/lib/ssh-libssh.c b/lib/ssh-libssh.c
5017ec
index 4110be2..2414173 100644
5017ec
--- a/lib/ssh-libssh.c
5017ec
+++ b/lib/ssh-libssh.c
5017ec
@@ -1112,7 +1112,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
5017ec
         flags = O_WRONLY|O_APPEND;
5017ec
       else
5017ec
         /* Clear file before writing (normal behaviour) */
5017ec
-        flags = O_WRONLY|O_APPEND|O_CREAT|O_TRUNC;
5017ec
+        flags = O_WRONLY|O_CREAT|O_TRUNC;
5017ec
 
5017ec
       if(sshc->sftp_file)
5017ec
         sftp_close(sshc->sftp_file);
5017ec
-- 
5017ec
2.39.2
5017ec