Skip to content

Commit

Permalink
SCP/SFTP: improve error code used for send failures
Browse files Browse the repository at this point in the history
Instead of relying on the generic CURLE error for SCP or SFTP send
failures, try passing back a more suitable error if possible.
  • Loading branch information
bagder committed Nov 12, 2012
1 parent 7ecd874 commit 1c23d2b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ssh.c
Expand Up @@ -2982,6 +2982,10 @@ static ssize_t scp_send(struct connectdata *conn, int sockindex,
*err = CURLE_AGAIN;
nwrite = 0;
}
else if(nwrite < LIBSSH2_ERROR_NONE) {
*err = libssh2_session_error_to_CURLE(nwrite);
nwrite = -1;
}

return nwrite;
}
Expand Down Expand Up @@ -3126,6 +3130,10 @@ static ssize_t sftp_send(struct connectdata *conn, int sockindex,
*err = CURLE_AGAIN;
nwrite = 0;
}
else if(nwrite < LIBSSH2_ERROR_NONE) {
*err = libssh2_session_error_to_CURLE(nwrite);
nwrite = -1;
}

return nwrite;
}
Expand Down

0 comments on commit 1c23d2b

Please sign in to comment.