Neels Hofmeyr has submitted this change and it was merged.

Change subject: hlr_db_tool: fix error log strerror invocation
......................................................................


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
---
M src/hlr_db_tool.c
1 file changed, 4 insertions(+), 4 deletions(-)

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



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

-- 
To view, visit https://gerrit.osmocom.org/4713
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaab46f565a1112d8a7def8ea90a5cd440c0a3b41
Gerrit-PatchSet: 2
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to