]> granicus.if.org Git - curl/commitdiff
ssh-libssh: do not specify O_APPEND when not in append mode
authorFelix Hädicke <felixhaedicke@web.de>
Wed, 24 Jul 2019 09:47:51 +0000 (11:47 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 25 Jul 2019 21:29:21 +0000 (23:29 +0200)
Specifying O_APPEND in conjunction with O_TRUNC and O_CREAT does not
make much sense. And this combination of flags is not accepted by all
SFTP servers (at least not Apache SSHD).

Fixes #4147
Closes #4148

lib/ssh-libssh.c

index ca13376775bb6fa20fdffae47f957bf0eaa6161e..879358eba28e544eecfa02930146bdacec2eb00a 100644 (file)
@@ -1119,7 +1119,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
         flags = O_WRONLY|O_APPEND;
       else
         /* Clear file before writing (normal behaviour) */
-        flags = O_WRONLY|O_APPEND|O_CREAT|O_TRUNC;
+        flags = O_WRONLY|O_CREAT|O_TRUNC;
 
       if(sshc->sftp_file)
         sftp_close(sshc->sftp_file);