diff options
Diffstat (limited to 'src/sp')
| -rw-r--r-- | src/sp/transport/socket/sockfd_test.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/sp/transport/socket/sockfd_test.c b/src/sp/transport/socket/sockfd_test.c index c12d4466..aba5af4e 100644 --- a/src/sp/transport/socket/sockfd_test.c +++ b/src/sp/transport/socket/sockfd_test.c @@ -13,13 +13,19 @@ #include <nuts.h> #ifdef NNG_PLATFORM_POSIX -#include <unistd.h> #include <fcntl.h> +#include <unistd.h> #ifdef NNG_PLATFORM_SUNOS #include <zone.h> #endif #endif +// Windows complains if we use the POSIX API. +#ifdef NNG_PLATFORM_WINDOWS +#include <io.h> +#define close(fd) _close(fd) +#endif + // FDC tests. static void test_sfd_connect_fail(void) @@ -134,7 +140,7 @@ test_sfd_recv_max(void) nng_listener l0; nng_listener l1; size_t sz; - size_t scratch; + size_t scratch; int fds[2]; NUTS_PASS(nng_socket_pair(fds)); @@ -385,8 +391,8 @@ test_sfd_listen_full(void) for (i = 0; i < NNG_SFD_LISTEN_QUEUE * 2; i += 2) { int pair[2]; NUTS_PASS(nng_socket_pair(pair)); - fds[i] = pair[0]; - fds[i+1] = pair[1]; + fds[i] = pair[0]; + fds[i + 1] = pair[1]; } NUTS_OPEN(s); NUTS_PASS(nng_listener_create(&l, s, "socket://")); @@ -409,12 +415,13 @@ test_sfd_listen_full(void) void test_sfd_fd_option_type(void) { - nng_socket s; + nng_socket s; nng_listener l; NUTS_OPEN(s); NUTS_PASS(nng_listener_create(&l, s, "socket://")); - NUTS_FAIL(nng_listener_set_bool(l, NNG_OPT_SOCKET_FD, false), NNG_EBADTYPE); + NUTS_FAIL( + nng_listener_set_bool(l, NNG_OPT_SOCKET_FD, false), NNG_EBADTYPE); NUTS_CLOSE(s); } @@ -422,9 +429,9 @@ void test_sfd_fd_dev_zero(void) { #ifdef NNG_PLATFORM_POSIX - nng_socket s; + nng_socket s; nng_listener l; - int fd; + int fd; // dev/zero produces a stream of zero bytes leading to protocol error NUTS_ASSERT((fd = open("/dev/zero", O_RDONLY, 0777)) >= 0); @@ -458,4 +465,4 @@ NUTS_TESTS = { #endif { NULL, NULL }, -};
\ No newline at end of file +}; |
