aboutsummaryrefslogtreecommitdiff
path: root/libssh/sftp.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-05-17 20:01:34 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-05-17 20:08:10 +0200
commit2c014256f7f7490d7b45c7b452b8711b5c8e938f (patch)
tree04973139cb70a8e9bbc01d13b6360d27fa31bad0 /libssh/sftp.c
parent488e822c8d242760f3f47e10d7f071edee65923f (diff)
downloadlibssh-2c014256f7f7490d7b45c7b452b8711b5c8e938f.tar.gz
libssh-2c014256f7f7490d7b45c7b452b8711b5c8e938f.tar.xz
libssh-2c014256f7f7490d7b45c7b452b8711b5c8e938f.zip
Fix sftp_rename on sftp3
Diffstat (limited to 'libssh/sftp.c')
-rw-r--r--libssh/sftp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libssh/sftp.c b/libssh/sftp.c
index a3b0a198..250c093f 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -2339,8 +2339,9 @@ int sftp_rename(sftp_session sftp, const char *original, const char *newname) {
if (buffer_add_u32(buffer, id) < 0 ||
buffer_add_ssh_string(buffer, oldpath) < 0 ||
buffer_add_ssh_string(buffer, newpath) < 0 ||
- /* POSIX rename atomically replaces newpath, we should do the same */
- buffer_add_u32(buffer, SSH_FXF_RENAME_OVERWRITE) < 0) {
+ /* POSIX rename atomically replaces newpath, we should do the same
+ * only available on >=v4 */
+ sftp->version>=4 ? (buffer_add_u32(buffer, SSH_FXF_RENAME_OVERWRITE) < 0):0) {
ssh_set_error_oom(sftp->session);
ssh_buffer_free(buffer);
ssh_string_free(oldpath);