aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 2def61f08..0ac280f61 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2058,9 +2058,11 @@ CURLcode Curl_ftp(struct connectdata *conn)
CURLcode Curl_ftpsendf(struct connectdata *conn,
const char *fmt, ...)
{
- size_t bytes_written;
+ ssize_t bytes_written;
char s[256];
- size_t write_len;
+ ssize_t write_len;
+ char *sptr=s;
+ CURLcode res = CURLE_OK;
va_list ap;
va_start(ap, fmt);
@@ -2074,9 +2076,23 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
bytes_written=0;
write_len = strlen(s);
- Curl_write(conn, conn->firstsocket, s, write_len, &bytes_written);
- return (bytes_written==write_len)?CURLE_OK:CURLE_WRITE_ERROR;
+ do {
+ res = Curl_write(conn, conn->firstsocket, sptr, write_len,
+ &bytes_written);
+
+ if(CURLE_OK != res)
+ break;
+
+ if(bytes_written != write_len) {
+ write_len -= bytes_written;
+ sptr += bytes_written;
+ }
+ else
+ break;
+ } while(1);
+
+ return res;
}
/***********************************************************************