diff options
author | Saúl Ibarra Corretgé <saghul@gmail.com> | 2014-04-22 22:45:58 +0200 |
---|---|---|
committer | Saúl Ibarra Corretgé <saghul@gmail.com> | 2014-04-22 22:57:01 +0200 |
commit | 9b4f2b84f10c96efa37910f324bc66e27aec3828 (patch) | |
tree | 325eda81b35e0eeca11166aca21ad50117ea2e2b /test/test-tcp-bind-error.c | |
parent | d86d86633e5f7ff07cd94d31a495ec6bef619aa1 (diff) | |
download | libuv-9b4f2b84f10c96efa37910f324bc66e27aec3828.tar.gz libuv-9b4f2b84f10c96efa37910f324bc66e27aec3828.zip |
unix, windows: validate flags on uv_udp|tcp_bind
fixes #1247
Diffstat (limited to 'test/test-tcp-bind-error.c')
-rw-r--r-- | test/test-tcp-bind-error.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test-tcp-bind-error.c b/test/test-tcp-bind-error.c index 96bfe116..10ed68e1 100644 --- a/test/test-tcp-bind-error.c +++ b/test/test-tcp-bind-error.c @@ -185,6 +185,23 @@ TEST_IMPL(tcp_bind_localhost_ok) { } +TEST_IMPL(tcp_bind_invalid_flags) { + struct sockaddr_in addr; + uv_tcp_t server; + int r; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + r = uv_tcp_init(uv_default_loop(), &server); + ASSERT(r == 0); + r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, UV_TCP_IPV6ONLY); + ASSERT(r == UV_EINVAL); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + TEST_IMPL(tcp_listen_without_bind) { int r; uv_tcp_t server; |