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
This commit is contained in:
Neels Hofmeyr
2017-11-07 13:20:44 +01:00
committed by Neels Hofmeyr
parent 85e8a64bb4
commit 87a04b6b95

View File

@@ -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;
}