sftp: Refromat sftp_open, sftp_opendir

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
Jakub Jelen
2023-06-01 12:05:59 +02:00
parent 6bebac10b7
commit 7009df7b04

View File

@@ -1037,7 +1037,7 @@ sftp_dir sftp_opendir(sftp_session sftp, const char *path)
sftp_file file = NULL;
sftp_dir dir = NULL;
sftp_status_message status;
ssh_buffer payload;
ssh_buffer payload = NULL;
uint32_t id;
int rc;
@@ -1115,7 +1115,8 @@ sftp_dir sftp_opendir(sftp_session sftp, const char *path)
return dir;
default:
ssh_set_error(sftp->session, SSH_FATAL,
"Received message %d during opendir!", msg->packet_type);
"Received message %d during opendir!",
msg->packet_type);
sftp_message_free(msg);
}
@@ -1819,7 +1820,7 @@ sftp_file sftp_open(sftp_session sftp,
sftp_status_message status;
struct sftp_attributes_struct attr;
sftp_file handle;
ssh_buffer buffer;
ssh_buffer buffer = NULL;
sftp_attributes stat_data;
uint32_t sftp_flags = 0;
uint32_t id;
@@ -1851,7 +1852,8 @@ sftp_file sftp_open(sftp_session sftp,
if ((flags & O_APPEND) == O_APPEND) {
sftp_flags |= SSH_FXF_APPEND;
}
SSH_LOG(SSH_LOG_PACKET, "Opening file %s with sftp flags %" PRIx32, file, sftp_flags);
SSH_LOG(SSH_LOG_PACKET, "Opening file %s with sftp flags %" PRIx32,
file, sftp_flags);
id = sftp_get_new_id(sftp);
rc = ssh_buffer_pack(buffer,
@@ -1937,10 +1939,12 @@ sftp_file sftp_open(sftp_session sftp,
return NULL;
}
void sftp_file_set_nonblocking(sftp_file handle){
void sftp_file_set_nonblocking(sftp_file handle)
{
handle->nonblocking = 1;
}
void sftp_file_set_blocking(sftp_file handle){
void sftp_file_set_blocking(sftp_file handle)
{
handle->nonblocking = 0;
}