Skip to content

Commit 64fe4cc

Browse files
authored
Display the actual port that we bind() to. (#62)
1 parent cbf356b commit 64fe4cc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

darkhttpd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ static void init_sockin(void) {
886886
if (getsockname(sockin, (struct sockaddr *)&addrin6, &addrin_len) == -1)
887887
err(1, "getsockname()");
888888
printf("listening on: http://[%s]:%u/\n",
889-
get_address_text(&addrin6.sin6_addr), bindport);
889+
get_address_text(&addrin6.sin6_addr), ntohs(addrin6.sin6_port));
890890
} else
891891
#endif
892892
{
@@ -899,7 +899,7 @@ static void init_sockin(void) {
899899
if (getsockname(sockin, (struct sockaddr *)&addrin, &addrin_len) == -1)
900900
err(1, "getsockname()");
901901
printf("listening on: http://%s:%u/\n",
902-
get_address_text(&addrin.sin_addr), bindport);
902+
get_address_text(&addrin.sin_addr), ntohs(addrin.sin_port));
903903
}
904904

905905
/* listen on socket */

0 commit comments

Comments
 (0)