Change in libosmo-sccp[master]: check for osmo_fsm_register() failures and propagate error

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Dec 1 16:37:18 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/16388 )


Change subject: check for osmo_fsm_register() failures and propagate error
......................................................................

check for osmo_fsm_register() failures and propagate error

Change-Id: Id8861144e4880383a173b7e6ae7860beebac09d9
---
M examples/sccp_demo_user.c
M src/osmo_ss7.c
M stp/stp_main.c
M tests/ss7/ss7_test.c
M tests/vty/ss7_asp_vty_test.c
5 files changed, 22 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/88/16388/1

diff --git a/examples/sccp_demo_user.c b/examples/sccp_demo_user.c
index 28dd166..b55b50c 100644
--- a/examples/sccp_demo_user.c
+++ b/examples/sccp_demo_user.c
@@ -230,7 +230,7 @@
 	signal(SIGUSR2, &signal_handler);
 
 	init_logging();
-	osmo_ss7_init();
+	OSMO_ASSERT(osmo_ss7_init() == 0);
 	osmo_fsm_log_addr(false);
 	vty_init(&vty_info);
 	osmo_ss7_vty_init_asp(NULL);
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index a07fbed..1ca8b5e 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -2061,13 +2061,26 @@
 
 int osmo_ss7_init(void)
 {
+	int rc;
+
 	if (ss7_initialized)
 		return 1;
-	osmo_fsm_register(&sccp_scoc_fsm);
-	osmo_fsm_register(&xua_as_fsm);
-	osmo_fsm_register(&xua_asp_fsm);
-	osmo_fsm_register(&ipa_asp_fsm);
-	osmo_fsm_register(&xua_default_lm_fsm);
+	rc = osmo_fsm_register(&sccp_scoc_fsm);
+	if (rc < 0)
+		return rc;
+	rc = osmo_fsm_register(&xua_as_fsm);
+	if (rc < 0)
+		return rc;
+	rc = osmo_fsm_register(&xua_asp_fsm);
+	if (rc < 0)
+		return rc;
+	rc = osmo_fsm_register(&ipa_asp_fsm);
+	if (rc < 0)
+		return rc;
+	rc = osmo_fsm_register(&xua_default_lm_fsm);
+	if (rc < 0)
+		return rc;
+
 	ss7_initialized = true;
 	return 0;
 }
diff --git a/stp/stp_main.c b/stp/stp_main.c
index 4cc2586..3923ed2 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -175,7 +175,7 @@
 	fputs(stp_copyright, stdout);
 	fputs("\n", stdout);
 
-	osmo_ss7_init();
+	OSMO_ASSERT(osmo_ss7_init() == 0);
 	osmo_fsm_log_addr(false);
 	logging_vty_add_cmds();
 	osmo_stats_vty_add_cmds();
diff --git a/tests/ss7/ss7_test.c b/tests/ss7/ss7_test.c
index a3f47b6..ae96a4b 100644
--- a/tests/ss7/ss7_test.c
+++ b/tests/ss7/ss7_test.c
@@ -302,7 +302,7 @@
 	osmo_fsm_log_addr(false);
 
 	/* init */
-	osmo_ss7_init();
+	OSMO_ASSERT(osmo_ss7_init() == 0);
 	s7i = osmo_ss7_instance_find_or_create(NULL, 0);
 	OSMO_ASSERT(osmo_ss7_instance_find(0) == s7i);
 	OSMO_ASSERT(osmo_ss7_instance_find(23) == NULL);
diff --git a/tests/vty/ss7_asp_vty_test.c b/tests/vty/ss7_asp_vty_test.c
index 76ffcf2..eb575bc 100644
--- a/tests/vty/ss7_asp_vty_test.c
+++ b/tests/vty/ss7_asp_vty_test.c
@@ -164,7 +164,7 @@
 	osmo_init_logging2(root_ctx, &log_info);
 	logging_vty_add_cmds();
 
-	osmo_ss7_init();
+	OSMO_ASSERT(osmo_ss7_init() == 0);
 	osmo_ss7_vty_init_asp(root_ctx);
 	osmo_sccp_vty_init();
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/16388
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Id8861144e4880383a173b7e6ae7860beebac09d9
Gerrit-Change-Number: 16388
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191201/cf5ea903/attachment.htm>


More information about the gerrit-log mailing list