Skip to content

Commit

Permalink
Display the actual port that we bind() to. (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-rden authored Mar 19, 2024
1 parent cbf356b commit 64fe4cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions darkhttpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ static void init_sockin(void) {
if (getsockname(sockin, (struct sockaddr *)&addrin6, &addrin_len) == -1)
err(1, "getsockname()");
printf("listening on: http://[%s]:%u/\n",
get_address_text(&addrin6.sin6_addr), bindport);
get_address_text(&addrin6.sin6_addr), ntohs(addrin6.sin6_port));
} else
#endif
{
Expand All @@ -899,7 +899,7 @@ static void init_sockin(void) {
if (getsockname(sockin, (struct sockaddr *)&addrin, &addrin_len) == -1)
err(1, "getsockname()");
printf("listening on: http://%s:%u/\n",
get_address_text(&addrin.sin_addr), bindport);
get_address_text(&addrin.sin_addr), ntohs(addrin.sin_port));
}

/* listen on socket */
Expand Down

0 comments on commit 64fe4cc

Please sign in to comment.