forked from extern/endlessh
Explicitly initialize sockaddr_in members
This commit is contained in:
parent
93b94f6b44
commit
2f79375360
@ -425,8 +425,11 @@ server_create(int port)
|
|||||||
r = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &dummy, sizeof(dummy));
|
r = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &dummy, sizeof(dummy));
|
||||||
if (r == -1) die();
|
if (r == -1) die();
|
||||||
|
|
||||||
struct sockaddr_in addr = {AF_INET, htons(port)};
|
struct sockaddr_in addr = {
|
||||||
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
.sin_family = AF_INET,
|
||||||
|
.sin_port = htons(port),
|
||||||
|
.sin_addr.s_addr = htonl(INADDR_ANY)
|
||||||
|
};
|
||||||
r = bind(s, (void *)&addr, sizeof(addr));
|
r = bind(s, (void *)&addr, sizeof(addr));
|
||||||
if (r == -1) die();
|
if (r == -1) die();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user