From f846711ea2d4df40a85f338654f5fa004b612e2c Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 15 Jul 2020 12:03:15 +0100 Subject: [PATCH] mosquitto_pub now sends 0 length files without an error when using `-f`. --- ChangeLog.txt | 1 + client/pub_shared.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 140031fc..19a2d82d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -53,6 +53,7 @@ Clients: - Add `--random-filter` to mosquitto_sub, to allow only a certain proportion of received messages to be printed. - mosquitto_sub %j and %J timestamps are now in a ISO 8601 compatible format. +- mosquitto_pub now sends 0 length files without an error when using `-f`. 1.6.9 - 20200227 diff --git a/client/pub_shared.c b/client/pub_shared.c index 81996a4f..01ff8b17 100644 --- a/client/pub_shared.c +++ b/client/pub_shared.c @@ -99,8 +99,9 @@ int load_file(const char *filename) return 1; }else if(cfg.msglen == 0){ fclose(fptr); - err_printf(&cfg, "Error: File \"%s\" is empty.\n", filename); - return 1; + cfg.message = NULL; + cfg.msglen = 0; + return 0; }else if(cfg.msglen < 0){ fclose(fptr); err_printf(&cfg, "Error: Unable to determine size of file \"%s\".\n", filename);