summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-01 13:05:27 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-01 13:05:27 +0100
commit6a1d172c952149aa6548f37b1e8fb8d9d931b329 (patch)
tree427d0bd8cb08d23f881f7814fd44b5f9f0fc2c7e
parent45ee133d1d7392efcb446f5f79cf47cf792ee21a (diff)
db: evaluate return value of sqlite3_finalize(), tweak log output.
-rw-r--r--openbsc/src/utils/meas_db.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/openbsc/src/utils/meas_db.c b/openbsc/src/utils/meas_db.c
index cf4ce6e2e..6c7e7ae6e 100644
--- a/openbsc/src/utils/meas_db.c
+++ b/openbsc/src/utils/meas_db.c
@@ -315,15 +315,21 @@ err_io:
void meas_db_close(struct meas_db_state *st)
{
int retries;
- sqlite3_finalize(st->stmt_ins_mr);
- sqlite3_finalize(st->stmt_ins_ud);
- sqlite3_finalize(st->stmt_upd_mr);
+ if (sqlite3_finalize(st->stmt_ins_mr) != SQLITE_OK)
+ fprintf(stderr, "DB insert measurement report finalize error: %s\n",
+ sqlite3_errmsg(st->db));
+ if (sqlite3_finalize(st->stmt_ins_ud) != SQLITE_OK)
+ fprintf(stderr, "DB insert unidir finalize error: %s\n",
+ sqlite3_errmsg(st->db));
+ if (sqlite3_finalize(st->stmt_upd_mr) != SQLITE_OK)
+ fprintf(stderr, "DB update measurement report finalize error: %s\n",
+ sqlite3_errmsg(st->db));
retries = 0;
while (1) {
if (sqlite3_close(st->db) == SQLITE_OK)
break;
if ((++retries) >= 3) {
- fprintf(stderr, "Unable to close DB\n");
+ fprintf(stderr, "Unable to close DB, abandoning.\n");
break;
}
sleep(1);