Removed goto from code.

This commit is contained in:
Klaas Freitag 2013-05-13 15:29:29 +02:00
parent cb0e06e7f8
commit 885eaad729

View file

@ -246,20 +246,22 @@ out:
} }
int csync_statedb_write(CSYNC *ctx) { int csync_statedb_write(CSYNC *ctx) {
bool recreate_db = false;
/* drop tables */ /* drop tables */
if (csync_statedb_drop_tables(ctx) < 0) { if (csync_statedb_drop_tables(ctx) < 0) {
goto retry_create; recreate_db = true;
} }
/* create tables */ /* create tables */
if (csync_statedb_create_tables(ctx) < 0) { if (! recreate_db) {
goto retry_create; if (csync_statedb_create_tables(ctx) < 0) {
recreate_db = true;
}
} }
if (0) { if (recreate_db) {
char *statedb_tmp; char *statedb_tmp;
int rc; int rc;
retry_create:
if (asprintf(&statedb_tmp, "%s.ctmp", ctx->statedb.file) < 0) { if (asprintf(&statedb_tmp, "%s.ctmp", ctx->statedb.file) < 0) {
return -1; return -1;
} }