aboutsummaryrefslogtreecommitdiff
path: root/src/sftp.c
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2015-09-25 00:34:42 +0200
committerFabiano FidĂȘncio <fidencio@redhat.com>2016-01-19 11:31:08 +0100
commit05fd0acf457f6514f4dff4d6d2d3906776a76437 (patch)
treebf60c88a30f7a7feb2026d6034f7697682c77d94 /src/sftp.c
parent25707e97520c7787f0a742dea419afca4c8cad41 (diff)
downloadlibssh-05fd0acf457f6514f4dff4d6d2d3906776a76437.tar.gz
libssh-05fd0acf457f6514f4dff4d6d2d3906776a76437.tar.xz
libssh-05fd0acf457f6514f4dff4d6d2d3906776a76437.zip
buffer: do not use ssh_buffer_get_rest_len()
As ssh_buffer_get_len() actually calls ssh_buffer_get_rest_len(), let's just use the first one. This is a preparatory step for removing ssh_buffer_get_rest_len(). Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/sftp.c')
-rw-r--r--src/sftp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sftp.c b/src/sftp.c
index 6f7e726c..69d95845 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -282,20 +282,20 @@ int sftp_packet_write(sftp_session sftp, uint8_t type, ssh_buffer payload){
return -1;
}
- size = htonl(ssh_buffer_get_rest_len(payload));
+ size = htonl(ssh_buffer_get_len(payload));
if (ssh_buffer_prepend_data(payload, &size, sizeof(uint32_t)) < 0) {
ssh_set_error_oom(sftp->session);
return -1;
}
size = ssh_channel_write(sftp->channel, ssh_buffer_get(payload),
- ssh_buffer_get_rest_len(payload));
+ ssh_buffer_get_len(payload));
if (size < 0) {
return -1;
- } else if((uint32_t) size != ssh_buffer_get_rest_len(payload)) {
+ } else if((uint32_t) size != ssh_buffer_get_len(payload)) {
SSH_LOG(SSH_LOG_PACKET,
"Had to write %d bytes, wrote only %d",
- ssh_buffer_get_rest_len(payload),
+ ssh_buffer_get_len(payload),
size);
}
@@ -461,7 +461,7 @@ static sftp_message sftp_get_message(sftp_packet packet) {
msg->packet_type);
if (ssh_buffer_add_data(msg->payload, ssh_buffer_get(packet->payload),
- ssh_buffer_get_rest_len(packet->payload)) < 0) {
+ ssh_buffer_get_len(packet->payload)) < 0) {
ssh_set_error_oom(sftp->session);
sftp_message_free(msg);
return NULL;
@@ -1968,7 +1968,7 @@ ssize_t sftp_write(sftp_file file, const void *buf, size_t count) {
ssh_buffer_free(buffer);
return -1;
}
- packetlen=ssh_buffer_get_rest_len(buffer);
+ packetlen=ssh_buffer_get_len(buffer);
len = sftp_packet_write(file->sftp, SSH_FXP_WRITE, buffer);
ssh_buffer_free(buffer);
if (len < 0) {