comparison utils/sip-udp-dump.c @ 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 87c077b23996
children
comparison
equal deleted inserted replaced
42:891ebfb55e6b 43:5995660dcbac
65 } 65 }
66 sin.sin_family = AF_INET; 66 sin.sin_family = AF_INET;
67 sin.sin_addr.s_addr = INADDR_ANY; 67 sin.sin_addr.s_addr = INADDR_ANY;
68 sin.sin_port = htons(5060); 68 sin.sin_port = htons(5060);
69 rc = bind(sock, (struct sockaddr *) &sin, sizeof sin); 69 rc = bind(sock, (struct sockaddr *) &sin, sizeof sin);
70 if (rc < 0) 70 if (rc < 0) {
71 perror("bind"); 71 perror("bind");
72 exit(1);
73 }
72 for (;;) { 74 for (;;) {
73 addrlen = sizeof sin; 75 addrlen = sizeof sin;
74 rc = recvfrom(sock, dgram, sizeof(dgram) - 1, 0, 76 rc = recvfrom(sock, dgram, sizeof(dgram) - 1, 0,
75 (struct sockaddr *) &sin, &addrlen); 77 (struct sockaddr *) &sin, &addrlen);
76 if (rc < 0) { 78 if (rc < 0) {