mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
Reformat sftp_packet_write().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@572 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -191,22 +191,27 @@ void sftp_free(SFTP_SESSION *sftp){
|
|||||||
|
|
||||||
int sftp_packet_write(SFTP_SESSION *sftp,u8 type, BUFFER *payload){
|
int sftp_packet_write(SFTP_SESSION *sftp,u8 type, BUFFER *payload){
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
if (buffer_prepend_data(payload, &type, sizeof(u8)) < 0) {
|
if (buffer_prepend_data(payload, &type, sizeof(u8)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
size=htonl(buffer_get_len(payload));
|
|
||||||
|
size = htonl(buffer_get_len(payload));
|
||||||
if (buffer_prepend_data(payload, &size, sizeof(u32)) < 0) {
|
if (buffer_prepend_data(payload, &size, sizeof(u32)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
size=channel_write(sftp->channel,buffer_get(payload),buffer_get_len(payload));
|
|
||||||
|
size = channel_write(sftp->channel, buffer_get(payload),
|
||||||
|
buffer_get_len(payload));
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if((u32) size != buffer_get_len(payload)){
|
} else if((u32) size != buffer_get_len(payload)) {
|
||||||
ssh_log(sftp->session, SSH_LOG_PACKET,
|
ssh_log(sftp->session, SSH_LOG_PACKET,
|
||||||
"Had to write %d bytes, wrote only %d",
|
"Had to write %d bytes, wrote only %d",
|
||||||
buffer_get_len(payload),
|
buffer_get_len(payload),
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user