# HG changeset patch # User Ed Maste # Date 1349135302 -7200 # Node ID 00956ff1864c851bd1a04dffa18bd3ce00c8eba8 # Parent 622e1fb82f06361f116977db967a4f9440ccbea0 select, poll tests: Make setsockopt invocation effective. * tests/test-poll.c (open_server_socket): Move setsockopt() call before the bind() call. * tests/test-select.h (open_server_socket): Likewise. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-10-01 Ed Maste (tiny change) + + select, poll tests: Make setsockopt invocation effective. + * tests/test-poll.c (open_server_socket): Move setsockopt() call before + the bind() call. + * tests/test-select.h (open_server_socket): Likewise. + 2012-09-30 Paul Eggert sockets, sys_stat: restore AC_C_INLINE diff --git a/tests/test-poll.c b/tests/test-poll.c --- a/tests/test-poll.c +++ b/tests/test-poll.c @@ -96,6 +96,9 @@ s = socket (AF_INET, SOCK_STREAM, 0); + x = 1; + setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); + memset (&ia, 0, sizeof (ia)); ia.sin_family = AF_INET; inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); @@ -106,9 +109,6 @@ exit (77); } - x = 1; - setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); - if (listen (s, 1) < 0) { perror ("listen"); diff --git a/tests/test-select.h b/tests/test-select.h --- a/tests/test-select.h +++ b/tests/test-select.h @@ -84,6 +84,9 @@ s = socket (AF_INET, SOCK_STREAM, 0); + x = 1; + setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); + memset (&ia, 0, sizeof (ia)); ia.sin_family = AF_INET; inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); @@ -94,9 +97,6 @@ exit (77); } - x = 1; - setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); - if (listen (s, 1) < 0) { perror ("listen");