aboutsummaryrefslogtreecommitdiff
path: root/libssh/scp.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-04-28 19:36:39 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-04-28 19:36:39 +0200
commit7d32ec5d28ecdf72f69d14794fd2fc98003b3fdd (patch)
tree8e8d37cffd037c8609cc08ce69d3c45aa0f965cd /libssh/scp.c
parent20e7ec96ae01d4367a7fbcd87bdbf0fa6496492b (diff)
downloadlibssh-7d32ec5d28ecdf72f69d14794fd2fc98003b3fdd.tar.gz
libssh-7d32ec5d28ecdf72f69d14794fd2fc98003b3fdd.tar.xz
libssh-7d32ec5d28ecdf72f69d14794fd2fc98003b3fdd.zip
Fix warnings found with clang analyzer
Diffstat (limited to 'libssh/scp.c')
-rw-r--r--libssh/scp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libssh/scp.c b/libssh/scp.c
index 52a28091..9590e2d2 100644
--- a/libssh/scp.c
+++ b/libssh/scp.c
@@ -112,6 +112,11 @@ int ssh_scp_init(ssh_scp scp){
}
if(scp->mode == SSH_SCP_WRITE){
r=channel_read(scp->channel,&code,1,0);
+ if(r<=0){
+ ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
+ scp->state=SSH_SCP_ERROR;
+ return SSH_ERROR;
+ }
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;
@@ -207,6 +212,11 @@ int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode){
return SSH_ERROR;
}
r=channel_read(scp->channel,&code,1,0);
+ if(r<=0){
+ ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
+ scp->state=SSH_SCP_ERROR;
+ return SSH_ERROR;
+ }
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;
@@ -239,6 +249,11 @@ int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode){
return SSH_ERROR;
}
r=channel_read(scp->channel,&code,1,0);
+ if(r<=0){
+ ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
+ scp->state=SSH_SCP_ERROR;
+ return SSH_ERROR;
+ }
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;
@@ -286,6 +301,11 @@ int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int mode){
return SSH_ERROR;
}
r=channel_read(scp->channel,&code,1,0);
+ if(r<=0){
+ ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
+ scp->state=SSH_SCP_ERROR;
+ return SSH_ERROR;
+ }
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;