mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 05:15:40 +03:00
csync: Do not compute the journal name in csync_update any more.
Rely on the name that was passed to csync_init()
This commit is contained in:
parent
3033e693be
commit
b9ea7c3414
2 changed files with 7 additions and 13 deletions
|
@ -121,7 +121,7 @@ void csync_create(CSYNC **csync, const char *local, const char *remote) {
|
|||
*csync = ctx;
|
||||
}
|
||||
|
||||
void csync_init(CSYNC *ctx) {
|
||||
void csync_init(CSYNC *ctx, const char *db_file) {
|
||||
assert(ctx);
|
||||
/* Do not initialize twice */
|
||||
|
||||
|
@ -132,6 +132,8 @@ void csync_init(CSYNC *ctx) {
|
|||
|
||||
ctx->remote.type = REMOTE_REPLICA;
|
||||
|
||||
ctx->statedb.file = c_strdup(db_file);
|
||||
|
||||
c_rbtree_create(&ctx->local.tree, _key_cmp, _data_cmp);
|
||||
c_rbtree_create(&ctx->remote.tree, _key_cmp, _data_cmp);
|
||||
|
||||
|
@ -153,19 +155,11 @@ int csync_update(CSYNC *ctx) {
|
|||
}
|
||||
ctx->status_code = CSYNC_STATUS_OK;
|
||||
|
||||
/* create/load statedb */
|
||||
rc = asprintf(&ctx->statedb.file, "%s/.csync_journal.db",
|
||||
ctx->local.uri);
|
||||
if (rc < 0) {
|
||||
ctx->status_code = CSYNC_STATUS_MEMORY_ERROR;
|
||||
return rc;
|
||||
}
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Journal: %s", ctx->statedb.file);
|
||||
|
||||
if (csync_statedb_load(ctx, ctx->statedb.file, &ctx->statedb.db) < 0) {
|
||||
/* Path of database file is set in csync_init */
|
||||
if (csync_statedb_load(ctx, ctx->statedb.file, &ctx->statedb.db) < 0) {
|
||||
rc = -1;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->status_code = CSYNC_STATUS_OK;
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ void csync_create(CSYNC **csync, const char *local, const char *remote);
|
|||
*
|
||||
* @param ctx The context to initialize.
|
||||
*/
|
||||
void csync_init(CSYNC *ctx);
|
||||
void csync_init(CSYNC *ctx, const char *db_file);
|
||||
|
||||
/**
|
||||
* @brief Update detection
|
||||
|
|
Loading…
Reference in a new issue