Commit ccb308ea authored by Mickaël Turnel's avatar Mickaël Turnel

Fix ZRTP file renaming while still in use

parent 2b3d4ae3
......@@ -47,6 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mediastreamer2/msjpegwriter.h"
#include "mediastreamer2/msogl.h"
#include "mediastreamer2/msvolume.h"
#include <errno.h>
#ifdef INET6
#ifndef _WIN32
......@@ -6616,9 +6617,18 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
/* rename the newly created sqlite3 file in to the given file name */
rename(file, bkpFile);
#ifdef _WIN32
/* We first have to close the file before renaming it */
sqlite3_close(lc->zrtp_cache_db);
#endif
if (rename(tmpFile, file)==0) { /* set the flag if we were able to set the sqlite file in the correct place (even if migration failed) */
lp_config_set_int(lc->config, "sip", "zrtp_cache_migration_done", TRUE);
}
#ifdef _WIN32
/* Then reopen it */
_linphone_sqlite3_open(file, &lc->zrtp_cache_db);
#endif
/* clean up */
bctbx_free(bkpFile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment