fix anetGenericAccept error return check (#8835)

the anetGenericAccept return ANET_ERR but outside use constant -1

Co-authored-by: libo <buaa_libo@126.com>
This commit is contained in:
Oran Agra 2021-04-21 13:33:18 +03:00 committed by GitHub
parent 5f6e166bce
commit bb16cf0f4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -507,7 +507,7 @@ int anetTcpAccept(char *err, int s, char *ip, size_t ip_len, int *port) {
int fd;
struct sockaddr_storage sa;
socklen_t salen = sizeof(sa);
if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == -1)
if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == ANET_ERR)
return ANET_ERR;
if (sa.ss_family == AF_INET) {
@ -526,7 +526,7 @@ int anetUnixAccept(char *err, int s) {
int fd;
struct sockaddr_un sa;
socklen_t salen = sizeof(sa);
if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == -1)
if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == ANET_ERR)
return ANET_ERR;
return fd;