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; }