Skip to content

Compiler warning. #1

@lv-zheng

Description

@lv-zheng

这个编译警告可以解决吗?

gcc -W -Wall -lpthread -o httpd httpd.c
httpd.c: In function ‘startup’:
httpd.c:533:52: warning: pointer targets in passing argument 3 of ‘getsockname’ differ in signedness [-Wpointer-sign]
   if (getsockname(httpd, (struct sockaddr *)&name, &namelen) == -1)
                                                    ^
In file included from httpd.c:23:0:
/usr/include/sys/socket.h:127:12: note: expected ‘socklen_t * restrict {aka unsigned int * restrict}’ but argument is of type ‘int *’
 extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
            ^
httpd.c: In function ‘main’:
httpd.c:591:24: warning: pointer targets in passing argument 3 of ‘accept’ differ in signedness [-Wpointer-sign]
                        &client_name_len);
                        ^
In file included from httpd.c:23:0:
/usr/include/sys/socket.h:243:12: note: expected ‘socklen_t * restrict {aka unsigned int * restrict}’ but argument is of type ‘int *’
 extern int accept (int __fd, __SOCKADDR_ARG __addr,
            ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions