mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-10 10:26:47 +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_file file = NULL;
|
||||||
sftp_dir dir = NULL;
|
sftp_dir dir = NULL;
|
||||||
sftp_status_message status;
|
sftp_status_message status;
|
||||||
ssh_buffer payload;
|
ssh_buffer payload = NULL;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -1115,7 +1115,8 @@ sftp_dir sftp_opendir(sftp_session sftp, const char *path)
|
|||||||
return dir;
|
return dir;
|
||||||
default:
|
default:
|
||||||
ssh_set_error(sftp->session, SSH_FATAL,
|
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);
|
sftp_message_free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1819,7 +1820,7 @@ sftp_file sftp_open(sftp_session sftp,
|
|||||||
sftp_status_message status;
|
sftp_status_message status;
|
||||||
struct sftp_attributes_struct attr;
|
struct sftp_attributes_struct attr;
|
||||||
sftp_file handle;
|
sftp_file handle;
|
||||||
ssh_buffer buffer;
|
ssh_buffer buffer = NULL;
|
||||||
sftp_attributes stat_data;
|
sftp_attributes stat_data;
|
||||||
uint32_t sftp_flags = 0;
|
uint32_t sftp_flags = 0;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
@@ -1851,7 +1852,8 @@ sftp_file sftp_open(sftp_session sftp,
|
|||||||
if ((flags & O_APPEND) == O_APPEND) {
|
if ((flags & O_APPEND) == O_APPEND) {
|
||||||
sftp_flags |= SSH_FXF_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);
|
id = sftp_get_new_id(sftp);
|
||||||
|
|
||||||
rc = ssh_buffer_pack(buffer,
|
rc = ssh_buffer_pack(buffer,
|
||||||
@@ -1937,11 +1939,13 @@ sftp_file sftp_open(sftp_session sftp,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sftp_file_set_nonblocking(sftp_file handle){
|
void sftp_file_set_nonblocking(sftp_file handle)
|
||||||
handle->nonblocking=1;
|
{
|
||||||
|
handle->nonblocking = 1;
|
||||||
}
|
}
|
||||||
void sftp_file_set_blocking(sftp_file handle){
|
void sftp_file_set_blocking(sftp_file handle)
|
||||||
handle->nonblocking=0;
|
{
|
||||||
|
handle->nonblocking = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read from a file using an opened sftp file handle. */
|
/* Read from a file using an opened sftp file handle. */
|
||||||
|
|||||||
Reference in New Issue
Block a user