If there is no vio commit function don't fail.

This commit is contained in:
Andreas Schneider 2013-04-24 14:35:19 +02:00
parent b09093a496
commit 9409d1c96e
3 changed files with 10 additions and 5 deletions

View file

@ -692,6 +692,7 @@ int csync_commit(CSYNC *ctx) {
if (rc < 0) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "commit failed: %s",
ctx->error_string ? ctx->error_string : "");
goto out;
}
/* destroy the rbtrees */
@ -751,6 +752,8 @@ int csync_commit(CSYNC *ctx) {
ctx->status = CSYNC_STATUS_INIT;
SAFE_FREE(ctx->error_string);
rc = 0;
out:
return rc;
}

View file

@ -594,8 +594,11 @@ int csync_vio_set_property(CSYNC* ctx, const char* key, void* data) {
}
int csync_vio_commit(CSYNC *ctx) {
int rc = -1;
if(VIO_METHOD_HAS_FUNC(ctx->module.method, commit))
rc = ctx->module.method->commit();
int rc = 0;
if (VIO_METHOD_HAS_FUNC(ctx->module.method, commit)) {
rc = ctx->module.method->commit();
}
return rc;
}

View file

@ -77,10 +77,9 @@ static void check_csync_commit(void **state)
int rc;
rc = csync_commit(csync);
assert_int_equal(rc, -1);
assert_int_equal(rc, 0);
assert_int_equal(csync->status & CSYNC_STATUS_INIT, 1);
}
static void check_csync_commit_dummy(void **state)