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));
|
||||
if (r == -1) die();
|
||||
|
||||
struct sockaddr_in addr = {AF_INET, htons(port)};
|
||||
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
struct sockaddr_in addr = {
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons(port),
|
||||
.sin_addr.s_addr = htonl(INADDR_ANY)
|
||||
};
|
||||
r = bind(s, (void *)&addr, sizeof(addr));
|
||||
if (r == -1) die();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user