From 429c89255787ef67f55804de64bffc9b6d70cf1f Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Oct 2014 20:51:17 +0100 Subject: [PATCH] Fix saving persistent database on Windows. Thanks to Daniel Degasperi. --- ChangeLog.txt | 1 + src/persist.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 2e055ed6..b668d145 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ Broker: - Fix possible memory leak when using a topic that has a leading slash. Fixes bug #1360985. +- Fix saving persistent database on Windows. Client library: - Fix mutex being incorrectly passed by value. Fixes bug #1373785. diff --git a/src/persist.c b/src/persist.c index 01866060..f4e2c694 100644 --- a/src/persist.c +++ b/src/persist.c @@ -402,6 +402,12 @@ int mqtt3_db_backup(struct mosquitto_db *db, bool cleanup, bool shutdown) fclose(db_fptr); +#ifdef WIN32 + if(remove(db->config->persistence_filepath) != 0){ + goto error; + } +} +#endif if(rename(outfile, db->config->persistence_filepath) != 0){ goto error; }