examples/mqttc: Fix handling of getaddrinfo errors
commit set a hostname to work
around getaddrinfo failing. getaddrinfo returns a non-zero value on
error, and there should be an early return after the error message is
printed.
@@ -153,9 +153,10 @@ static int initserver(const FAR struct mqttc_cfg_s *cfg)
printf("Connecting to %s:%s...\n", cfg->host, cfg->port);
ret = getaddrinfo(cfg->host, cfg->port, &hints, &servinfo);
- if (ret < 0)
+ if (ret != OK)
{
printf("ERROR! getaddrinfo() failed: %s\n", gai_strerror(ret));
+ return -1;
}
itr = servinfo;
