Change in osmo-bsc[master]: Meas Tools: Avoid unusable terminal in case of error on osmo_sock_init

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 Mar 29 14:23:36 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/17648 )

Change subject: Meas Tools: Avoid unusable terminal in case of error on osmo_sock_init
......................................................................

Meas Tools: Avoid unusable terminal in case of error on osmo_sock_init

If, as before this patch we call initCDKScreen() before
attempting to bind the socket, then the socket bind fails,
we exit and the terminal needs a reset.

Attempt to open the socket before initCDKScreen()
so we don't end up with a messed up terminal if the socket
call fails.

Change-Id: Ia5148d9ef386df314bc2837b3cb672150250bd2a
---
M src/utils/meas_vis.c
1 file changed, 4 insertions(+), 5 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/utils/meas_vis.c b/src/utils/meas_vis.c
index aea12bf..e10d814 100644
--- a/src/utils/meas_vis.c
+++ b/src/utils/meas_vis.c
@@ -283,6 +283,10 @@
 
 	printf("sizeof(gsm_meas_rep)=%u\n", sizeof(struct gsm_meas_rep));
 	printf("sizeof(meas_feed_meas)=%u\n", sizeof(struct meas_feed_meas));
+	g_st.udp_ofd.cb = udp_fd_cb;
+	rc =  osmo_sock_init_ofd(&g_st.udp_ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, 8888, OSMO_SOCK_F_BIND);
+	if (rc < 0)
+		exit(1);
 
 	INIT_LLIST_HEAD(&g_st.ms_list);
 	g_st.curses_win = initscr();
@@ -311,11 +315,6 @@
 	exit(0);
 #endif
 
-	g_st.udp_ofd.cb = udp_fd_cb;
-	rc =  osmo_sock_init_ofd(&g_st.udp_ofd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, 8888, OSMO_SOCK_F_BIND);
-	if (rc < 0)
-		exit(1);
-
 	while (1) {
 		osmo_select_main(0);
 		update_sliders();

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/17648
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia5148d9ef386df314bc2837b3cb672150250bd2a
Gerrit-Change-Number: 17648
Gerrit-PatchSet: 5
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200329/1d17c271/attachment.htm>


More information about the gerrit-log mailing list