Commit ece20ca8 authored by Martti Mela's avatar Martti Mela

torture_su_root.c: minor bug fixes

darcs-hash:20070206154822-1b897-cc0c0280363db57f8cddf53eaaeec9288a2b2dbf.gz
parent f3ab0c90
......@@ -148,6 +148,7 @@ int test_wakeup(su_port_t *port, su_root_magic_t *magic)
if (su_sendto(magic->sockets[1], "X", 1, 0, su, sulen) < 0)
su_perror("su_sendto"), exit(1);
n = su_poll_port_wait_events(port, 100);
if (n != 1)
return 1;
if (magic->error)
......
......@@ -54,6 +54,7 @@ typedef struct test_ep_s test_ep_t;
#include <sofia-sip/su_wait.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_log.h>
struct test_ep_s {
test_ep_t *next, **prev, **list;
......@@ -330,7 +331,7 @@ int event_test(root_test_t rt[1])
TEST_1(nodes = calloc(N, sizeof *nodes));
memset(su, 0, sulen = sizeof su);
memset(su, 0, sulen = sizeof su->su_sin);
su->su_len = sizeof su->su_sin;
su->su_family = AF_INET;
su->su_sin.sin_addr.s_addr = htonl(0x7f000001); /* 127.0.0.1 */
......@@ -344,9 +345,22 @@ int event_test(root_test_t rt[1])
n->addrlen = sizeof n->addr;
if (bind(n->s, (void *)su, sulen) < 0 ||
getsockname(n->s, (void *)n->addr, &n->addrlen) ||
su_wait_create(n->wait, n->s, SU_WAIT_IN)) {
n->addr->su_len = sizeof n->addr;
if (bind(n->s, (void *)su, sulen) < 0) {
su_perror("bind()");
su_close(n->s);
break;
}
if (getsockname(n->s, (void *)n->addr, &n->addrlen)) {
su_perror("getsockname()");
su_close(n->s);
break;
}
if (su_wait_create(n->wait, n->s, SU_WAIT_IN)) {
su_perror("su_wait_create()");
su_close(n->s);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment