stun

simple point to point tunnel
git clone git://git.2f30.org/stun
Log | Files | Refs | README

commit b775bd7c75e7332879b3326038da545c5a6e19ad
parent bdad0d6d7657249906370ec612d281275685bc8c
Author: sin <sin@2f30.org>
Date:   Sat,  2 Apr 2016 09:33:26 +0100

fix style

Diffstat:
Mstun.c | 9+++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/stun.c b/stun.c @@ -615,8 +615,7 @@ serversetup(int devfd) logerr("getaddrinfo: %s", gai_strerror(ret)); for (p = ai; p; p = p->ai_next) { - listenfd = socket(AF_INET, SOCK_STREAM, 0); - if (listenfd < 0) + if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) continue; setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (int []){1}, sizeof(int)); @@ -679,8 +678,7 @@ clientsetup(int devfd) logerr("getaddrinfo: %s", gai_strerror(ret)); for (p = ai; p; p = p->ai_next) { - netfd = socket(AF_INET, SOCK_STREAM, 0); - if (netfd < 0) + if ((netfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) continue; if (connect(netfd, p->ai_addr, p->ai_addrlen) < 0) { close(netfd); @@ -770,8 +768,7 @@ main(int argc, char *argv[]) devfd = opendev(argv[0]); - pw = getenv("STUNPW"); - if (!pw) + if (!(pw = getenv("STUNPW"))) logerr("STUNPW is not set"); derivekey(pw, strlen(pw)); explicit_bzero(pw, strlen(pw));