diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-07 13:20:44 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-11-08 02:29:05 +0000 |
commit | 87a04b6b95d827c5c82c3e7ffb99f60e86028f25 (patch) | |
tree | df78edbe8c91b452c53a8a43a59677e8e1b3ca5b | |
parent | 85e8a64bb42086909e4793782963887fb1ceb421 (diff) |
hlr_db_tool: fix error log strerror invocation
The db API returns negative errno values, need to flip the sign before feeding
to strerror.
Fixes: coverity CID#178658
Change-Id: Iaab46f565a1112d8a7def8ea90a5cd440c0a3b41
-rw-r--r-- | src/hlr_db_tool.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hlr_db_tool.c b/src/hlr_db_tool.c index 8982739..eb82c92 100644 --- a/src/hlr_db_tool.c +++ b/src/hlr_db_tool.c @@ -284,12 +284,12 @@ void import_nitb_subscr(sqlite3 *nitb_db, sqlite3_stmt *stmt) snprintf(imsi_str, sizeof(imsi_str), "%"PRId64, imsi); rc = db_subscr_create(dbc, imsi_str); - if (rc) { + if (rc < 0) { LOGP(DDB, LOGL_ERROR, "OsmoNITB DB import to %s: failed to create IMSI %s: %d: %s\n", dbc->fname, imsi_str, rc, - strerror(rc)); + strerror(-rc)); /* on error, still attempt to continue */ } @@ -303,13 +303,13 @@ void import_nitb_subscr(sqlite3 *nitb_db, sqlite3_stmt *stmt) /* find the just created id */ rc = db_subscr_get_by_imsi(dbc, imsi_str, &subscr); - if (rc) { + if (rc < 0) { LOGP(DDB, LOGL_ERROR, "OsmoNITB DB import to %s: created IMSI %s," " but failed to get new subscriber id: %d: %s\n", dbc->fname, imsi_str, rc, - strerror(rc)); + strerror(-rc)); return; } |