From 1c23d2b39290032f739b1b441aba8bf89a0b834f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 12 Nov 2012 10:04:44 +0100 Subject: [PATCH] SCP/SFTP: improve error code used for send failures Instead of relying on the generic CURLE error for SCP or SFTP send failures, try passing back a more suitable error if possible. --- lib/ssh.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ssh.c b/lib/ssh.c index e8b717273..d0dd2c746 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -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; } @@ -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; }