Skip to content

Commit

Permalink
print error when listener bind address is not valid
Browse files Browse the repository at this point in the history
Signed-off-by: Vinod Kumar <[email protected]>
  • Loading branch information
kumar003vinod authored and ralight committed Mar 13, 2019
1 parent 8d513af commit e9350fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ int net__socket_listen(struct mosquitto__listener *listener)
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;

if(getaddrinfo(listener->host, service, &hints, &ainfo)) return INVALID_SOCKET;
rc = getaddrinfo(listener->host, service, &hints, &ainfo);
if (rc){
log__printf(NULL, MOSQ_LOG_ERR, "Error creating listener: %s.", gai_strerror(rc));
return INVALID_SOCKET;
}

listener->sock_count = 0;
listener->socks = NULL;
Expand Down

0 comments on commit e9350fb

Please sign in to comment.