[MERGED] libosmocore[master]: cosmetic: osmo_fsm_inst_update_id(): don't log "allocate"

2018-04-09 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged.

Change subject: cosmetic: osmo_fsm_inst_update_id(): don't log "allocate"
..


cosmetic: osmo_fsm_inst_update_id(): don't log "allocate"

On erratic id in osmo_fsm_inst_update_id(), don't say "Attempting to allocate
FSM instance".

Escape the invalid id using osmo_quote_str().

Change-Id: I770fc460de21faa42b403f694e853e8da01c4bef
---
M src/fsm.c
M tests/fsm/fsm_test.err
2 files changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved



diff --git a/src/fsm.c b/src/fsm.c
index 9bbf870..0fdc564 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -213,8 +213,9 @@
 {
if (id) {
if (!osmo_identifier_valid(id)) {
-   LOGP(DLGLOBAL, LOGL_ERROR, "Attempting to allocate FSM 
instance of type '%s'"
-" with illegal identifier '%s'\n", fi->fsm->name, 
id);
+   LOGP(DLGLOBAL, LOGL_ERROR,
+"Attempting to set illegal id for FSM instance of 
type '%s': %s\n",
+fi->fsm->name, osmo_quote_str(id, -1));
return -EINVAL;
}
osmo_talloc_replace_string(fi, (char **)>id, id);
diff --git a/tests/fsm/fsm_test.err b/tests/fsm/fsm_test.err
index c4ee46f..3e01d48 100644
--- a/tests/fsm/fsm_test.err
+++ b/tests/fsm/fsm_test.err
@@ -38,12 +38,12 @@
   osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
   osmo_fsm_inst_find_by_id("arbitrary_id") == fi
 osmo_fsm_inst_update_id("")
-Attempting to allocate FSM instance of type 'Test_FSM' with illegal identifier 
''
+Attempting to set illegal id for FSM instance of type 'Test_FSM': ""
 rc == -22, ok
   osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
   osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
 osmo_fsm_inst_update_id("invalid.id")
-Attempting to allocate FSM instance of type 'Test_FSM' with illegal identifier 
'invalid.id'
+Attempting to set illegal id for FSM instance of type 'Test_FSM': "invalid.id"
 rc == -22, ok
   osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
   osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I770fc460de21faa42b403f694e853e8da01c4bef
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: cosmetic: osmo_fsm_inst_update_id(): don't log "allocate"

2018-04-09 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I770fc460de21faa42b403f694e853e8da01c4bef
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] libosmocore[master]: cosmetic: osmo_fsm_inst_update_id(): don't log "allocate"

2018-04-08 Thread Neels Hofmeyr

Review at  https://gerrit.osmocom.org/7682

cosmetic: osmo_fsm_inst_update_id(): don't log "allocate"

On erratic id in osmo_fsm_inst_update_id(), don't say "Attempting to allocate
FSM instance".

Escape the invalid id using osmo_quote_str().

Change-Id: I770fc460de21faa42b403f694e853e8da01c4bef
---
M src/fsm.c
M tests/fsm/fsm_test.err
2 files changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/7682/1

diff --git a/src/fsm.c b/src/fsm.c
index 9bbf870..0fdc564 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -213,8 +213,9 @@
 {
if (id) {
if (!osmo_identifier_valid(id)) {
-   LOGP(DLGLOBAL, LOGL_ERROR, "Attempting to allocate FSM 
instance of type '%s'"
-" with illegal identifier '%s'\n", fi->fsm->name, 
id);
+   LOGP(DLGLOBAL, LOGL_ERROR,
+"Attempting to set illegal id for FSM instance of 
type '%s': %s\n",
+fi->fsm->name, osmo_quote_str(id, -1));
return -EINVAL;
}
osmo_talloc_replace_string(fi, (char **)>id, id);
diff --git a/tests/fsm/fsm_test.err b/tests/fsm/fsm_test.err
index c4ee46f..3e01d48 100644
--- a/tests/fsm/fsm_test.err
+++ b/tests/fsm/fsm_test.err
@@ -38,12 +38,12 @@
   osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
   osmo_fsm_inst_find_by_id("arbitrary_id") == fi
 osmo_fsm_inst_update_id("")
-Attempting to allocate FSM instance of type 'Test_FSM' with illegal identifier 
''
+Attempting to set illegal id for FSM instance of type 'Test_FSM': ""
 rc == -22, ok
   osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
   osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi
 osmo_fsm_inst_update_id("invalid.id")
-Attempting to allocate FSM instance of type 'Test_FSM' with illegal identifier 
'invalid.id'
+Attempting to set illegal id for FSM instance of type 'Test_FSM': "invalid.id"
 rc == -22, ok
   osmo_fsm_inst_name() == "Test_FSM(arbitrary_id)"
   osmo_fsm_inst_find_by_name("Test_FSM(arbitrary_id)") == fi

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I770fc460de21faa42b403f694e853e8da01c4bef
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr