From 06e1136ea05bdaa4321f8e68984b83ac4894066e Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Fri, 17 Jun 2005 17:18:25 +0000 Subject: [PATCH] Don't send flags for rename op if the sftp version is too low --- README | 3 +++ src/sftp.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README b/README index aada6b0..dc584a9 100644 --- a/README +++ b/README @@ -10,6 +10,9 @@ Version 0.11 Added queueing for small window_adjust packets to avoid unnecessary packet conversation. + Fixed libssh2_sftp_rename_ex() to only send flags parameter if version >= 5 negotiated + (not currently possible, but will be and might as well keep the API consistent). + Version 0.10 ------------ diff --git a/src/sftp.c b/src/sftp.c index 9f2c376..a9ae62f 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -1139,9 +1139,12 @@ LIBSSH2_API int libssh2_sftp_rename_ex(LIBSSH2_SFTP *sftp, char *source_filenam memcpy(s, source_filename, source_filename_len); s += source_filename_len; libssh2_htonu32(s, dest_filename_len); s += 4; memcpy(s, dest_filename, dest_filename_len); s += dest_filename_len; - libssh2_htonu32(s, flags); s += 4; - if (packet_len != libssh2_channel_write(channel, packet, packet_len)) { + if (sftp->version >= 5) { + libssh2_htonu32(s, flags); s += 4; + } + + if (packet_len != libssh2_channel_write(channel, packet, s - packet)) { libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send FXP_REMOVE command", 0); LIBSSH2_FREE(session, packet); return -1;