mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-28 20:39:40 +00:00
Error if bind to privileged port fails
This commit is contained in:
parent
d3fa08d78b
commit
917a51a406
@ -82,9 +82,15 @@ int main(int argc, char* argv[]) {
|
||||
if (sock < 0) continue;
|
||||
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int));
|
||||
if (curr->ai_family == AF_INET) {
|
||||
bind(sock, (struct sockaddr*)&net4bind, sizeof(struct sockaddr_in));
|
||||
if (bind(sock, (struct sockaddr*)&net4bind, sizeof(struct sockaddr_in)) < 0) {
|
||||
fprintf(stderr, "Unable to bind port 302\n");
|
||||
exit(1);
|
||||
}
|
||||
} else if (curr->ai_family == AF_INET6) {
|
||||
bind(sock, (struct sockaddr*)&net6bind, sizeof(struct sockaddr_in6));
|
||||
if (bind(sock, (struct sockaddr*)&net6bind, sizeof(struct sockaddr_in6)) < 0) {
|
||||
fprintf(stderr, "Unable to bind port 302\n");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user