changeset 43:5995660dcbac

sip-rx-test, sip-udp-dump: fix bind error handling
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 04 Sep 2022 21:38:02 -0800
parents 891ebfb55e6b
children 30572642e853
files utils/sip-rx-test.c utils/sip-udp-dump.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/utils/sip-rx-test.c	Sun Sep 04 17:55:40 2022 -0800
+++ b/utils/sip-rx-test.c	Sun Sep 04 21:38:02 2022 -0800
@@ -105,8 +105,10 @@
 	sin.sin_addr.s_addr = INADDR_ANY;
 	sin.sin_port = htons(5060);
 	rc = bind(sock, (struct sockaddr *) &sin, sizeof sin);
-	if (rc < 0)
+	if (rc < 0) {
 		perror("bind");
+		exit(1);
+	}
 	addrlen = sizeof sin;
 	rc = recvfrom(sock, pkt.pkt_buffer, MAX_SIP_RX_PACKET, 0,
 			(struct sockaddr *) &sin, &addrlen);
--- a/utils/sip-udp-dump.c	Sun Sep 04 17:55:40 2022 -0800
+++ b/utils/sip-udp-dump.c	Sun Sep 04 21:38:02 2022 -0800
@@ -67,8 +67,10 @@
 	sin.sin_addr.s_addr = INADDR_ANY;
 	sin.sin_port = htons(5060);
 	rc = bind(sock, (struct sockaddr *) &sin, sizeof sin);
-	if (rc < 0)
+	if (rc < 0) {
 		perror("bind");
+		exit(1);
+	}
 	for (;;) {
 		addrlen = sizeof sin;
 		rc = recvfrom(sock, dgram, sizeof(dgram) - 1, 0,