diff options
author | cypherpunks <cypherpunks@torproject.org> | 2015-12-16 22:53:19 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-12-17 08:34:27 -0500 |
commit | 2d2312d98986d65af47d35a89e176b5cf9953533 (patch) | |
tree | 3f404edce6716b5cd13c4303956e603890a3bb09 /src/test | |
parent | 596f9a4b4cf9211827284905069166972aaf1e3b (diff) | |
download | tor-2d2312d98986d65af47d35a89e176b5cf9953533.tar.gz tor-2d2312d98986d65af47d35a89e176b5cf9953533.zip |
Conform to the type signature of setsockopt(2)
According to the POSIX standard the option value is a pointer to void
and the option length a socklen_t. The Windows implementation makes the
option value be a pointer to character and the option length an int.
Casting the option value to a pointer to void conforms to the POSIX
standard while the implicit cast to a pointer to character conforms to
the Windows implementation.
The casts of the option length to the socklen_t data type conforms to
the POSIX standard. The socklen_t data type is actually an alias of an
int so it also conforms to the Windows implementation.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_switch_id.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test_switch_id.c b/src/test/test_switch_id.c index 9b093671e8..a47858ab07 100644 --- a/src/test/test_switch_id.c +++ b/src/test/test_switch_id.c @@ -47,7 +47,8 @@ check_can_bind_low_ports(void) } int one = 1; - if (setsockopt(fd, SOL_SOCKET,SO_REUSEADDR, &one, sizeof(one))) { + if (setsockopt(fd, SOL_SOCKET,SO_REUSEADDR, (void*)&one, + (socklen_t)sizeof(one))) { perror("setsockopt"); tor_close_socket_simple(fd); return -1; |