diff --git a/examples/mqttc/mqttc_pub.c b/examples/mqttc/mqttc_pub.c index ea70a2d0c..6394dbf3e 100644 --- a/examples/mqttc/mqttc_pub.c +++ b/examples/mqttc/mqttc_pub.c @@ -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;