From bcfa29cbd16d338c3a9181d5c916f3be50560349 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 22 Jul 2016 10:37:30 +0100 Subject: [PATCH] [222] Fix will retained flag handling on Windows. Thanks to codami. Bug: https://github.com/eclipse/mosquitto/issues/222 --- ChangeLog.txt | 1 + src/read_handle_server.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 34ccbfb5..6a2466cb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,7 @@ Broker: - Call fsync after persisting data to ensure it is correctly written. Closes #189. - Fix persistence saving of subscription QoS on big-endian machines. +- Fix will retained flag handling on Windows. Closes #222. Client library: - Support OpenSSL 1.1.0. diff --git a/src/read_handle_server.c b/src/read_handle_server.c index 558adb0c..02fbc974 100644 --- a/src/read_handle_server.c +++ b/src/read_handle_server.c @@ -180,7 +180,7 @@ int mqtt3_handle_connect(struct mosquitto_db *db, struct mosquitto *context) rc = MOSQ_ERR_PROTOCOL; goto handle_connect_error; } - will_retain = connect_flags & 0x20; + will_retain = ((connect_flags & 0x20) == 0x20); // Temporary hack because MSVC<1800 doesn't have stdbool.h. password_flag = connect_flags & 0x40; username_flag = connect_flags & 0x80;