mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
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:
20
src/sftp.c
20
src/sftp.c
@@ -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,11 +1939,13 @@ sftp_file sftp_open(sftp_session sftp,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void sftp_file_set_nonblocking(sftp_file handle){
|
||||
handle->nonblocking=1;
|
||||
void sftp_file_set_nonblocking(sftp_file handle)
|
||||
{
|
||||
handle->nonblocking = 1;
|
||||
}
|
||||
void sftp_file_set_blocking(sftp_file handle){
|
||||
handle->nonblocking=0;
|
||||
void sftp_file_set_blocking(sftp_file handle)
|
||||
{
|
||||
handle->nonblocking = 0;
|
||||
}
|
||||
|
||||
/* Read from a file using an opened sftp file handle. */
|
||||
|
||||
Reference in New Issue
Block a user