警告:从不兼容的指针类型 [-Wincompatible-pointer-types] 传递‘accept’的参数 2

warning: passing argument 2 of ‘accept’ from incompatible pointer type [-Wincompatible-pointer-types]

我收到警告:从不兼容的指针类型 [-Wincompatible-pointer-types]

传递‘accept’的参数 2

为什么会出现此错误?

        if(s = accept(ls, &client_address, &client_address_len)<0);
        {
            perror("Error: accepting failed!!");
            exit(1);
        }

根据https://pubs.opengroup.org/onlinepubs/009695399/functions/accept.htmlaccept 函数的第二个参数接收类型struct sockaddr *。您可能想要进行转换:&client_address(struct sockaddr *)&client_address