[sr-dev] git:5.0:e7ebdcfe: htable: improve some error logs

Ovidiu Sas osas at voipembedded.com
Thu Jul 13 22:55:52 CEST 2017


Module: kamailio
Branch: 5.0
Commit: e7ebdcfee72d0d54c375383565fd1fcd3816c7c1
URL: https://github.com/kamailio/kamailio/commit/e7ebdcfee72d0d54c375383565fd1fcd3816c7c1

Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date: 2017-07-13T18:27:00-04:00

htable: improve some error logs

(cherry picked from commit 9dadfe9234d26d3b8b8ea0603b3f8fa13f96913c)

---

Modified: src/modules/htable/ht_db.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e7ebdcfee72d0d54c375383565fd1fcd3816c7c1.diff
Patch: https://github.com/kamailio/kamailio/commit/e7ebdcfee72d0d54c375383565fd1fcd3816c7c1.patch

---

diff --git a/src/modules/htable/ht_db.c b/src/modules/htable/ht_db.c
index fd5ec46c0e..5cdecb1814 100644
--- a/src/modules/htable/ht_db.c
+++ b/src/modules/htable/ht_db.c
@@ -276,7 +276,8 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
 		for(i=0; i<RES_ROW_N(db_res); i++)
 		{
 			if(VAL_NULL(&RES_ROWS(db_res)[i].values[0])) {
-				LM_ERR("key value must not be null\n");
+				LM_ERR("htable [%.*s] row [%d] has NULL key value\n",
+					ht->name.len, ht->name.s, i);
 				goto error;
 			}
 
@@ -284,7 +285,8 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
 			case DB1_STR:
 				kname.s = (RES_ROWS(db_res)[i].values[0].val.str_val.s);
 				if(kname.s==NULL) {
-					LM_ERR("null key in row %d\n", i);
+					LM_ERR("htable [%.*s] row [%d] has NULL key\n",
+						ht->name.len, ht->name.s, i);
 					goto error;
 				}
 				kname.len = (RES_ROWS(db_res)[i].values[0].val.str_val.len);
@@ -292,7 +294,8 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
 			case DB1_BLOB:
 				kname.s = (RES_ROWS(db_res)[i].values[0].val.blob_val.s);
 				if(kname.s==NULL) {
-					LM_ERR("null key in row %d\n", i);
+					LM_ERR("htable [%.*s] row [%d] has NULL key\n",
+						ht->name.len, ht->name.s, i);
 					goto error;
 				}
 				kname.len = (RES_ROWS(db_res)[i].values[0].val.blob_val.len);
@@ -300,7 +303,8 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
 			case DB1_STRING:
 				kname.s = (char*)(RES_ROWS(db_res)[i].values[0].val.string_val);
 				if(kname.s==NULL) {
-					LM_ERR("null key in row %d\n", i);
+					LM_ERR("htable [%.*s] row [%d] has NULL key\n",
+						ht->name.len, ht->name.s, i);
 					goto error;
 				}
 				kname.len = strlen(kname.s);




More information about the sr-dev mailing list