mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
resolve: Use sockaddr pointer type for bind()
bind() expects sockaddr* but SERVER_ADDRESS is sockaddr_in type struct Fixes errors with clang e.g. ../git/src/resolve/test-resolved-stream.c:112:32: error: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Werror,-Wincompatible-pointer-types] assert_se(bind(bindfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS)) >= 0); ^~~~~~~~~~~~~~~ ../git/src/resolve/test-resolved-stream.c:251:39: error: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Werror,-Wincompatible-pointer-types] r = connect(clientfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS)); Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
15d4c239f4
commit
0dd5ec58fa
@ -110,7 +110,7 @@ static void *tcp_dns_server(void *p) {
|
||||
|
||||
assert_se((bindfd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0)) >= 0);
|
||||
assert_se(setsockopt(bindfd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) >= 0);
|
||||
assert_se(bind(bindfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS)) >= 0);
|
||||
assert_se(bind(bindfd, (struct sockaddr*)&SERVER_ADDRESS, sizeof(SERVER_ADDRESS)) >= 0);
|
||||
assert_se(listen(bindfd, 1) >= 0);
|
||||
assert_se((acceptfd = accept(bindfd, NULL, NULL)) >= 0);
|
||||
server_handle(acceptfd);
|
||||
@ -247,7 +247,7 @@ static void test_dns_stream(bool tls) {
|
||||
assert_se((clientfd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0)) >= 0);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
r = connect(clientfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS));
|
||||
r = connect(clientfd, (struct sockaddr*)&SERVER_ADDRESS, sizeof(SERVER_ADDRESS));
|
||||
if (r >= 0)
|
||||
break;
|
||||
usleep(EVENT_TIMEOUT_USEC / 100);
|
||||
|
Loading…
Reference in New Issue
Block a user