From b807daed2867bc0bfbd21213a9e4736ab7811f29 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 24 Jul 2019 12:08:43 +0100 Subject: [PATCH] Fix error codes not being returned when mosquitto_pub exits. Closes #1354. Thanks to Ben Barbour. --- ChangeLog.txt | 4 ++++ client/pub_client.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 33a6cf3d..c6e86deb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -11,6 +11,10 @@ Client library: - Fix MQTT v5 subscription options being incorrectly set for MQTT v3 subscriptions. Closes #1353. +Clients: +- mosquitto_pub: fix error codes not being returned when mosquitto_pub exits. + Closes #1354. + 1.6.3 - 20190618 ================ diff --git a/client/pub_client.c b/client/pub_client.c index 31740391..fb25b451 100644 --- a/client/pub_client.c +++ b/client/pub_client.c @@ -103,7 +103,9 @@ void my_disconnect_callback(struct mosquitto *mosq, void *obj, int rc, const mos UNUSED(rc); UNUSED(properties); - status = STATUS_DISCONNECTED; + if(rc == 0){ + status = STATUS_DISCONNECTED; + } } int my_publish(struct mosquitto *mosq, int *mid, const char *topic, int payloadlen, void *payload, int qos, bool retain)