Fix setsockopt call.
Neither Windows nor POSIX uses a char for SO_REUSEADDR. Windows uses BOOL (which is actually int) and POSIX uses int. Windows also requires a cast due to using char* instead of void*. Thanks to Daniel Hirche for reporting. Change-Id: I01c847c8da285f27f3c3cdf5ff58b53899098b82 Reviewed-on: https://boringssl-review.googlesource.com/13100 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
parent
45573cc04d
commit
6add9f172c
@ -159,7 +159,11 @@ bool Accept(int *out_sock, const std::string &port) {
|
||||
addr.sin6_port = htons(atoi(port.c_str()));
|
||||
|
||||
bool ok = false;
|
||||
const char enable = 1;
|
||||
#if defined(OPENSSL_WINDOWS)
|
||||
const BOOL enable = TRUE;
|
||||
#else
|
||||
const int enable = 1;
|
||||
#endif
|
||||
int server_sock = -1;
|
||||
|
||||
server_sock =
|
||||
@ -169,7 +173,7 @@ bool Accept(int *out_sock, const std::string &port) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &enable,
|
||||
if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&enable,
|
||||
sizeof(enable)) < 0) {
|
||||
perror("setsockopt");
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user