Skip to content

Commit

Permalink
fix: port handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Apr 10, 2024
1 parent d0d9d06 commit 6ce0064
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static void create_socket(struct globals_t* g)
size_t good = 0;
const int on = 1;
int res;
uint16_t port;

union {
struct sockaddr sa;
Expand All @@ -39,7 +40,7 @@ static void create_socket(struct globals_t* g)
exit(EXIT_FAILURE);
}

uint16_t port = htons((uint16_t)atoi(g->bind_port));
port = (uint16_t)atoi(g->bind_port);
for (size_t i=0; i<g->nsockets; ++i) {
memset(&sin, 0, sizeof(sin));
if (inet_pton(AF_INET, g->bind_addresses[i], &sin.sa_in.sin_addr) == 1) {
Expand Down

0 comments on commit 6ce0064

Please sign in to comment.