Change in osmo-hlr[master]: src/db.c: don't ignore the result of db_bootstrap()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Mon Jul 30 14:19:37 UTC 2018


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/10241 )

Change subject: src/db.c: don't ignore the result of db_bootstrap()
......................................................................

src/db.c: don't ignore the result of db_bootstrap()

Change-Id: I0de3d4c4355c4dee8b832faae347586d1e1b3516
---
M src/db.c
1 file changed, 9 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/db.c b/src/db.c
index 2d1bdde..4b0577f 100644
--- a/src/db.c
+++ b/src/db.c
@@ -202,7 +202,7 @@
 		if (rc != SQLITE_OK) {
 			LOGP(DDB, LOGL_ERROR, "Unable to prepare SQL statement '%s'\n",
 			     stmt_bootstrap_sql[i]);
-			return -1;
+			return rc;
 		}
 
 		/* execute the statement */
@@ -214,10 +214,10 @@
 			     " during stmt '%s'",
 			     rc, sqlite3_errmsg(dbc->db),
 			     stmt_bootstrap_sql[i]);
-			return -1;
+			return rc;
 		}
 	}
-	return 0;
+	return SQLITE_OK;
 }
 
 struct db_context *db_open(void *ctx, const char *fname, bool enable_sqlite_logging)
@@ -274,7 +274,12 @@
 		LOGP(DDB, LOGL_ERROR, "Unable to set Write-Ahead Logging: %s\n",
 			err_msg);
 
-	db_bootstrap(dbc);
+	rc = db_bootstrap(dbc);
+	if (rc != SQLITE_OK) {
+		LOGP(DDB, LOGL_ERROR, "Failed to bootstrap DB: (rc=%d) %s\n",
+			rc, sqlite3_errmsg(dbc->db));
+		goto out_free;
+	}
 
 	/* prepare all SQL statements */
 	for (i = 0; i < ARRAY_SIZE(dbc->stmt); i++) {

-- 
To view, visit https://gerrit.osmocom.org/10241
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0de3d4c4355c4dee8b832faae347586d1e1b3516
Gerrit-Change-Number: 10241
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180730/08694830/attachment.htm>


More information about the gerrit-log mailing list