Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpd.c: fix compiler warning #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ int startup(u_short *port)
//如果调用 bind 后端口号仍然是0,则手动调用getsockname()获取端口号
if (*port == 0) /* if dynamically allocating a port */
{
int namelen = sizeof(name);
size_t namelen = sizeof(name);
//getsockname()包含于<sys/socker.h>中,参读《TLPI》P1263
//调用getsockname()获取系统给 httpd 这个 socket 随机分配的端口号
if (getsockname(httpd, (struct sockaddr *)&name, &namelen) == -1)
Expand Down Expand Up @@ -577,7 +577,7 @@ int main(void)
int client_sock = -1;
//sockaddr_in 是 IPV4的套接字地址结构。定义在<netinet/in.h>,参读《TLPI》P1202
struct sockaddr_in client_name;
int client_name_len = sizeof(client_name);
size_t client_name_len = sizeof(client_name);
//pthread_t newthread;

server_sock = startup(&port);
Expand Down