From f930970008707602ec8d32a453a87078afb6d928 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 17 Dec 2020 15:09:09 +0000 Subject: [PATCH] Fix persistence_location not appending a '/'. --- ChangeLog.txt | 1 + src/conf.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 3e44696f..366afe74 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -9,6 +9,7 @@ Broker: Closes #1956. - Fix local bridges being disconnected on SIGHUP. Closes #1942. - Fix slow initial bridge connections for WITH_ADNS=no. +- Fix persistence_location not appending a '/'. Clients: - Fix mosquitto_sub being unable to terminate with Ctrl-C if a successful diff --git a/src/conf.c b/src/conf.c index d6918d30..4eb70432 100644 --- a/src/conf.c +++ b/src/conf.c @@ -664,7 +664,11 @@ int config__read(struct mosquitto__config *config, bool reload) len = strlen(config->persistence_location) + strlen(config->persistence_file) + 1; config->persistence_filepath = mosquitto__malloc(len); if(!config->persistence_filepath) return MOSQ_ERR_NOMEM; - snprintf(config->persistence_filepath, len, "%s%s", config->persistence_location, config->persistence_file); +#ifdef WIN32 + snprintf(config->persistence_filepath, len, "%s\\%s", config->persistence_location, config->persistence_file); +#else + snprintf(config->persistence_filepath, len, "%s/%s", config->persistence_location, config->persistence_file); +#endif }else{ config->persistence_filepath = mosquitto__strdup(config->persistence_file); if(!config->persistence_filepath) return MOSQ_ERR_NOMEM;