X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet_setup.c;h=10fb37b0005c5df5ae73b35bf33a66a9591796ac;hb=a0b633156ddb653ac7f1cc809a1ba6cf86a928e1;hp=2cd021111a204aebb37b4e0273a12ec75e19beed;hpb=43ffcfc3c3fcd8088a77e9a2ac9cc4013c466158;p=meshlink diff --git a/src/net_setup.c b/src/net_setup.c index 2cd02111..10fb37b0 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -273,15 +273,14 @@ static bool add_listen_address(meshlink_handle_t *mesh, char *address, bool bind } } - struct addrinfo *ai, hint = {}; + struct addrinfo *ai; - hint.ai_family = addressfamily; - - hint.ai_socktype = SOCK_STREAM; - - hint.ai_protocol = IPPROTO_TCP; - - hint.ai_flags = AI_PASSIVE; + struct addrinfo hint = { + .ai_family = addressfamily, + .ai_socktype = SOCK_STREAM, + .ai_protocol = IPPROTO_TCP, + .ai_flags = AI_PASSIVE, + }; int err = getaddrinfo(address && *address ? address : NULL, port, &hint, &ai); @@ -366,8 +365,11 @@ bool setup_myself(meshlink_handle_t *mesh) { if(!get_config_string(lookup_config(mesh->config, "Port"), &mesh->myport)) { int port = check_port(mesh); - if (port == 0) + + if(port == 0) { return false; + } + xasprintf(&mesh->myport, "%d", port); }