mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-09 15:41:10 +03:00
sftp.c: Reformat sftp_init() according to the current coding style
Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
99e8f34142
commit
63ee84862b
15
src/sftp.c
15
src/sftp.c
@@ -414,7 +414,8 @@ int sftp_get_error(sftp_session sftp) {
|
||||
}
|
||||
|
||||
/* Initialize the sftp session with the server. */
|
||||
int sftp_init(sftp_session sftp) {
|
||||
int sftp_init(sftp_session sftp)
|
||||
{
|
||||
sftp_packet packet = NULL;
|
||||
ssh_buffer buffer = NULL;
|
||||
char *ext_name = NULL;
|
||||
@@ -436,10 +437,13 @@ int sftp_init(sftp_session sftp) {
|
||||
sftp_set_error(sftp, SSH_FX_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
if (sftp_packet_write(sftp, SSH_FXP_INIT, buffer) < 0) {
|
||||
|
||||
rc = sftp_packet_write(sftp, SSH_FXP_INIT, buffer);
|
||||
if (rc == SSH_ERROR) {
|
||||
SSH_BUFFER_FREE(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
SSH_BUFFER_FREE(buffer);
|
||||
|
||||
packet = sftp_packet_read(sftp);
|
||||
@@ -449,7 +453,8 @@ int sftp_init(sftp_session sftp) {
|
||||
|
||||
if (packet->type != SSH_FXP_VERSION) {
|
||||
ssh_set_error(sftp->session, SSH_FATAL,
|
||||
"Received a %d messages instead of SSH_FXP_VERSION", packet->type);
|
||||
"Received a %d messages instead of SSH_FXP_VERSION",
|
||||
packet->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -459,6 +464,7 @@ int sftp_init(sftp_session sftp) {
|
||||
sftp_set_error(sftp, SSH_FX_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_DEBUG,
|
||||
"SFTP server version %" PRIu32,
|
||||
version);
|
||||
@@ -485,6 +491,7 @@ int sftp_init(sftp_session sftp) {
|
||||
sftp_set_error(sftp, SSH_FX_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp[count - 1] = ext_name;
|
||||
sftp->ext->name = tmp;
|
||||
|
||||
@@ -496,6 +503,7 @@ int sftp_init(sftp_session sftp) {
|
||||
sftp_set_error(sftp, SSH_FX_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp[count - 1] = ext_data;
|
||||
sftp->ext->data = tmp;
|
||||
|
||||
@@ -506,7 +514,6 @@ int sftp_init(sftp_session sftp) {
|
||||
|
||||
sftp->version = sftp->server_version = (int)version;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user