From c5a376489ea437e75b79b9c35d45fa240db8fc92 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 18 Dec 2015 22:26:01 +0000 Subject: [PATCH] [483979] Fix "mosquitto_pub -l" stripping the final character on a line. Thanks to Allan Kobelansky. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=483979 --- ChangeLog.txt | 5 ++++- client/pub_client.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 9c6c5e6b..5f299bf2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,8 +3,11 @@ Client library: - Fix _mosquitto_socketpair() on Windows, reducing the chance of delays when - publishing. Closes #484693. + publishing. Closes #483979. +Clients: +- Fix "mosquitto_pub -l" stripping the final character on a line. Closes + #483981. 1.4.5 - 20151108 ================ diff --git a/client/pub_client.c b/client/pub_client.c index 5fc27ca0..c8ca981a 100644 --- a/client/pub_client.c +++ b/client/pub_client.c @@ -392,7 +392,7 @@ int main(int argc, char *argv[]) buf_len_actual = strlen(buf); if(buf[buf_len_actual-1] == '\n'){ buf[buf_len_actual-1] = '\0'; - rc2 = mosquitto_publish(mosq, &mid_sent, topic, buf_len_actual, buf, qos, retain); + rc2 = mosquitto_publish(mosq, &mid_sent, topic, buf_len_actual-1, buf, qos, retain); if(rc2){ if(!quiet) fprintf(stderr, "Error: Publish returned %d, disconnecting.\n", rc2); mosquitto_disconnect(mosq);