mqtt: on send error, return error

Reported-by: Maciej Domanski

Closes #10623
This commit is contained in:
Daniel Stenberg 2023-02-27 10:02:22 +01:00
parent 3b23dbeec1
commit 252fce70b1
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -122,8 +122,9 @@ static CURLcode mqtt_send(struct Curl_easy *data,
struct MQTT *mq = data->req.p.mqtt;
ssize_t n;
result = Curl_write(data, sockfd, buf, len, &n);
if(!result)
Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
if(result)
return result;
Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
if(len != (size_t)n) {
size_t nsend = len - n;
char *sendleftovers = Curl_memdup(&buf[n], nsend);