mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 22:46:04 +03:00
Always remove the temporary journal.
This commit is contained in:
parent
dddb81c5cd
commit
6601a2e49e
1 changed files with 7 additions and 4 deletions
|
@ -163,17 +163,20 @@ int csync_journal_close(CSYNC *ctx, const char *journal, int jwritten) {
|
|||
/* close the temporary database */
|
||||
sqlite3_close(ctx->journal.db);
|
||||
|
||||
if (asprintf(&journal_tmp, "%s.ctmp", journal) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* if we successfully synchronized, overwrite the original journal */
|
||||
if (jwritten) {
|
||||
if (asprintf(&journal_tmp, "%s.ctmp", journal) < 0) {
|
||||
return -1;
|
||||
}
|
||||
rc = c_copy(journal_tmp, journal, 0644);
|
||||
if (rc == 0) {
|
||||
unlink(journal_tmp);
|
||||
}
|
||||
SAFE_FREE(journal_tmp);
|
||||
} else {
|
||||
unlink(journal_tmp);
|
||||
}
|
||||
SAFE_FREE(journal_tmp);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue