fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/31617 )


Change subject: utils: fix incorrect string checks in meas_db_insert()
......................................................................

utils: fix incorrect string checks in meas_db_insert()

Comparing an array to null is not useful, since the test will
always evaluate as true (NO_EFFECT).

Change-Id: I8a41078070119bc22d594c0dfff5d98b5d16f970
Fixes: fbead4327 utils: store more fields from meas-feed in db
Fixes: CID#310821
---
M src/utils/meas_db.c
1 file changed, 17 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/17/31617/1

diff --git a/src/utils/meas_db.c b/src/utils/meas_db.c
index 1b4f1f3..2f81524 100644
--- a/src/utils/meas_db.c
+++ b/src/utils/meas_db.c
@@ -94,19 +94,19 @@
        SCK_OK(st->db, sqlite3_bind_int(st->stmt_ins_mr, 6, mfm->lchan_type));
        SCK_OK(st->db, sqlite3_bind_int(st->stmt_ins_mr, 7, mfm->pchan_type));

-       if (mfm->imsi)
+       if (mfm->imsi[0] != '\0')
                SCK_OK(st->db, sqlite3_bind_text(st->stmt_ins_mr, 8,
                                                 mfm->imsi, -1, SQLITE_STATIC));
        else
                SCK_OK(st->db, sqlite3_bind_null(st->stmt_ins_mr, 8));

-       if (mfm->name)
+       if (mfm->name[0] != '\0')
                SCK_OK(st->db, sqlite3_bind_text(st->stmt_ins_mr, 9,
                                                 mfm->name, -1, SQLITE_STATIC));
        else
                SCK_OK(st->db, sqlite3_bind_null(st->stmt_ins_mr, 9));

-       if (mfm->scenario)
+       if (mfm->scenario[0] != '\0')
                SCK_OK(st->db, sqlite3_bind_text(st->stmt_ins_mr, 10,
                                                 mfm->scenario, -1, 
SQLITE_STATIC));
        else

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31617
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I8a41078070119bc22d594c0dfff5d98b5d16f970
Gerrit-Change-Number: 31617
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to