From 8e3c2d9af7846c4924d177e5436e59158a194418 Mon Sep 17 00:00:00 2001 From: "Thomas Beckmann (M-Way)" Date: Thu, 29 Mar 2018 08:44:57 +0200 Subject: [PATCH] _mosquitto_net_read must call WSASetLastError when changing errno so that the error code can be picked up by _mosquitto_packet_read Signed-off-by: Thomas Beckmann (M-Way) --- lib/net_mosq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/net_mosq.c b/lib/net_mosq.c index d331ef07..06bcec0d 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -697,6 +697,9 @@ ssize_t net__write(struct mosquitto *mosq, void *buf, size_t count) net__print_ssl_error(mosq); errno = EPROTO; } +#ifdef WIN32 + WSASetLastError(errno); +#endif } return (ssize_t )ret; }else{