Message ID | 20220902071153.3168814-9-ammar.faizi@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Introducing t_bind_ephemeral_port() function | expand |
diff --git a/test/accept.c b/test/accept.c index b35ded4..1821faa 100644 --- a/test/accept.c +++ b/test/accept.c @@ -190,19 +190,16 @@ static int start_accept_listen(struct sockaddr_in *addr, int port_off, struct sockaddr_in laddr; if (!addr) addr = &laddr; addr->sin_family = AF_INET; - addr->sin_port = htons(0x1235 + port_off); addr->sin_addr.s_addr = inet_addr("127.0.0.1"); - - ret = bind(fd, (struct sockaddr*)addr, sizeof(*addr)); - assert(ret != -1); + assert(!t_bind_ephemeral_port(fd, addr)); ret = listen(fd, 128); assert(ret != -1); return fd; } static int set_client_fd(struct sockaddr_in *addr)